﻿namespace Vdc.Calendar2
{
    using Vdc.Calendar2.Designer;
    using System;
    using System.Collections;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Globalization;
    using System.IO;
    using System.Reflection;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Xml;

    [PersistChildren(false), ParseChildren(true, "SpecialDates"), Designer(typeof(CalendarDesigner), typeof(IDesigner)), Themeable(true), CLSCompliant(true)]
    public class Calendar : Control, IPostBackEventHandler, IPostBackDataHandler, INamingContainer
    {
        private bool _eventHandlerCalled;
        private bool _inForm = true;
        private CalendarSpecialDates _items;
        public static readonly object EventDateChanged = new object();
        private const string globalCultureName = "vi-VN";

        public event DateChangedEventHandler DateChanged
        {
            add
            {
                base.Events.AddHandler(EventDateChanged, value);
            }
            remove
            {
                base.Events.RemoveHandler(EventDateChanged, value);
            }
        }

        public void AddSpecialDate(DateTime data)
        {
            this.SpecialDates.Add(new SpecialDate(data));
        }

        public void AddSpecialDate(DateTime data, string ToolTip)
        {
            this.SpecialDates.Add(new SpecialDate(data, ToolTip));
        }

        public void AddSpecialDate(DateTime data, string ToolTip, string CSSClass)
        {
            this.SpecialDates.Add(new SpecialDate(data, ToolTip, CSSClass));
        }

        public void AddSpecialDate(int Year, int Month, int Day)
        {
            this.SpecialDates.Add(new SpecialDate(Year, Month, Day));
        }

        public void AddSpecialDate(DateTime data, string ToolTip, string CSSClass, string Url)
        {
            this.SpecialDates.Add(new SpecialDate(data, ToolTip, CSSClass, Url));
        }

        public void AddSpecialDate(int Year, int Month, int Day, string ToolTip)
        {
            this.SpecialDates.Add(new SpecialDate(Year, Month, Day, ToolTip));
        }

        public void AddSpecialDate(DateTime data, string ToolTip, string CSSClass, string CSSClassOver, string Url)
        {
            this.SpecialDates.Add(new SpecialDate(data, ToolTip, CSSClass, CSSClassOver, Url));
        }

        public void AddSpecialDate(int Year, int Month, int Day, string ToolTip, string CSSClass)
        {
            this.SpecialDates.Add(new SpecialDate(Year, Month, Day, ToolTip, CSSClass));
        }

        public void AddSpecialDate(int Year, int Month, int Day, string ToolTip, string CSSClass, string Url)
        {
            this.SpecialDates.Add(new SpecialDate(Year, Month, Day, ToolTip, CSSClass, Url));
        }

        public void AddSpecialDate(int Year, int Month, int Day, string ToolTip, string CSSClass, string CSSClassOver, string Url)
        {
            this.SpecialDates.Add(new SpecialDate(Year, Month, Day, ToolTip, CSSClass, CSSClassOver, Url));
        }

        private string createScript()
        {
            string str2;
            string str3;
            string str4;
            string str5;
            object obj3;
            string str = str2 = str3 = str4 = str5 = "new Array(";
            foreach (SpecialDate date in this.SpecialDates)
            {
                obj3 = str;
                str = string.Concat(new object[] { obj3, "new Date(", date.Year, ",", date.Month - 1, ",", date.Day, ")," });
                str2 = str2 + "\"" + date.ToolTip + "\",";
                str3 = str3 + "\"" + date.CSSClass + "\",";
                str4 = str4 + "\"" + date.CSSClassOver + "\",";
                str5 = str5 + "\"" + date.Url + "\",";
            }
            if (this.SpecialDates.Count != 0)
            {
                str = str.Remove(str.Length - 1, 1);
                str2 = str2.Remove(str2.Length - 1, 1);
                str3 = str3.Remove(str3.Length - 1, 1);
                str4 = str4.Remove(str4.Length - 1, 1);
                str5 = str5.Remove(str5.Length - 1, 1);
            }
            str = str + ")";
            str2 = str2 + ")";
            str3 = str3 + ")";
            str4 = str4 + ")";
            str5 = str5 + ")";
            string textBoxId = this.TextBoxId;
            if (this.DatePickerMode)
            {
                object obj2 = this.findControl(this.NamingContainer, typeof(TextBox), this.TextBoxId);
                if (obj2 != null)
                {
                    textBoxId = ((TextBox) obj2).ClientID;
                }
            }
            if ((this.StyleFolder == string.Empty) && (this.CSSPath == string.Empty))
            {
                if (this.ViewState["CSSCalendar"] == null)
                {
                    this.CSSCalendar = "calendarCalendarDefault";
                }
                if (this.ViewState["CSSTitle"] == null)
                {
                    this.CSSTitle = "calendarTitleDefault";
                }
                if (this.ViewState["CSSYearSelectorTitle"] == null)
                {
                    this.CSSYearSelectorTitle = "calendarYearSelectorTitleDefault";
                }
                if (this.ViewState["CSSYearSelectorContainer"] == null)
                {
                    this.CSSYearSelectorContainer = "calendarYearSelectorContainerDefault";
                }
                if (this.ViewState["CSSYearSelectorArrowUp"] == null)
                {
                    this.CSSYearSelectorArrowUp = "calendarYearSelectorArrowUpDefault";
                }
                if (this.ViewState["CSSYearSelectorArrowDown"] == null)
                {
                    this.CSSYearSelectorArrowDown = "calendarYearSelectorArrowDownDefault";
                }
                if (this.ViewState["CSSYearSelector"] == null)
                {
                    this.CSSYearSelector = "calendarYearSelectorDefault";
                }
                if (this.ViewState["CSSYearSelected"] == null)
                {
                    this.CSSYearSelected = "calendarYearSelectedDefault";
                }
                if (this.ViewState["CSSMonthSelectorTitle"] == null)
                {
                    this.CSSMonthSelectorTitle = "calendarMonthSelectorTitleDefault";
                }
                if (this.ViewState["CSSMonthSelectorContainer"] == null)
                {
                    this.CSSMonthSelectorContainer = "calendarMonthSelectorContainerDefault";
                }
                if (this.ViewState["CSSMonthSelectorArrowUp"] == null)
                {
                    this.CSSMonthSelectorArrowUp = "calendarMonthSelectorArrowUpDefault";
                }
                if (this.ViewState["CSSMonthSelectorArrowDown"] == null)
                {
                    this.CSSMonthSelectorArrowDown = "calendarMonthSelectorArrowDownDefault";
                }
                if (this.ViewState["CSSMonthSelector"] == null)
                {
                    this.CSSMonthSelector = "calendarMonthSelectorDefault";
                }
                if (this.ViewState["CSSMonthSelected"] == null)
                {
                    this.CSSMonthSelected = "calendarMonthSelectedDefault";
                }
                if (this.ViewState["CSSSelectTime"] == null)
                {
                    this.CSSSelectTime = "calendarSelectTimeDefault";
                }
                if (this.ViewState["CSSHourSelectorTitle"] == null)
                {
                    this.CSSHourSelectorTitle = "calendarHourSelectorTitleDefault";
                }
                if (this.ViewState["CSSHourSelectorContainer"] == null)
                {
                    this.CSSHourSelectorContainer = "calendarHourSelectorContainerDefault";
                }
                if (this.ViewState["CSSHourSelectorArrowUp"] == null)
                {
                    this.CSSHourSelectorArrowUp = "calendarHourSelectorArrowUpDefault";
                }
                if (this.ViewState["CSSHourSelectorArrowDown"] == null)
                {
                    this.CSSHourSelectorArrowDown = "calendarHourSelectorArrowDownDefault";
                }
                if (this.ViewState["CSSHourSelector"] == null)
                {
                    this.CSSHourSelector = "calendarHourSelectorDefault";
                }
                if (this.ViewState["CSSHourSelected"] == null)
                {
                    this.CSSHourSelected = "calendarHourSelectedDefault";
                }
                if (this.ViewState["CSSMinuteSelectorTitle"] == null)
                {
                    this.CSSMinuteSelectorTitle = "calendarMinuteSelectorTitleDefault";
                }
                if (this.ViewState["CSSMinuteSelectorContainer"] == null)
                {
                    this.CSSMinuteSelectorContainer = "calendarMinuteSelectorContainerDefault";
                }
                if (this.ViewState["CSSMinuteSelectorArrowUp"] == null)
                {
                    this.CSSMinuteSelectorArrowUp = "calendarMinuteSelectorArrowUpDefault";
                }
                if (this.ViewState["CSSMinuteSelectorArrowDown"] == null)
                {
                    this.CSSMinuteSelectorArrowDown = "calendarMinuteSelectorArrowDownDefault";
                }
                if (this.ViewState["CSSMinuteSelector"] == null)
                {
                    this.CSSMinuteSelector = "calendarMinuteSelectorDefault";
                }
                if (this.ViewState["CSSMinuteSelected"] == null)
                {
                    this.CSSMinuteSelected = "calendarMinuteSelectedDefault";
                }
                if (this.ViewState["CSSSecondSelectorTitle"] == null)
                {
                    this.CSSSecondSelectorTitle = "calendarSecondSelectorTitleDefault";
                }
                if (this.ViewState["CSSSecondSelectorContainer"] == null)
                {
                    this.CSSSecondSelectorContainer = "calendarSecondSelectorContainerDefault";
                }
                if (this.ViewState["CSSSecondSelectorArrowUp"] == null)
                {
                    this.CSSSecondSelectorArrowUp = "calendarSecondSelectorArrowUpDefault";
                }
                if (this.ViewState["CSSSecondSelectorArrowDown"] == null)
                {
                    this.CSSSecondSelectorArrowDown = "calendarSecondSelectorArrowDownDefault";
                }
                if (this.ViewState["CSSSecondSelector"] == null)
                {
                    this.CSSSecondSelector = "calendarSecondSelectorDefault";
                }
                if (this.ViewState["CSSSecondSelected"] == null)
                {
                    this.CSSSecondSelected = "calendarSecondSelectedDefault";
                }
                if (this.ViewState["CSSArrowLeft"] == null)
                {
                    this.CSSArrowLeft = "calendarArrowLeftDefault";
                }
                if (this.ViewState["CSSArrowRight"] == null)
                {
                    this.CSSArrowRight = "calendarArrowRightDefault";
                }
                if (this.ViewState["CSSMonth"] == null)
                {
                    this.CSSMonth = "calendarMonthDefault";
                }
                if (this.ViewState["CSSMonthTitle"] == null)
                {
                    this.CSSMonthTitle = "calendarMonthTitleDefault";
                }
                if (this.ViewState["CSSDayName"] == null)
                {
                    this.CSSDayName = "calendarDayNameDefault";
                }
                if (this.ViewState["CSSDay"] == null)
                {
                    this.CSSDay = "calendarDayDefault";
                }
                if (this.ViewState["CSSDayOver"] == null)
                {
                    this.CSSDayOver = "calendarDayOverDefault";
                }
                if (this.ViewState["CSSDayToday"] == null)
                {
                    this.CSSDayToday = "calendarDayTodayDefault";
                }
                if (this.ViewState["CSSDayTodayOver"] == null)
                {
                    this.CSSDayTodayOver = "calendarDayTodayOverDefault";
                }
                if (this.ViewState["CSSDayDisabled"] == null)
                {
                    this.CSSDayDisabled = "calendarDayDisabledDefault";
                }
                if (this.ViewState["CSSDayDisabledOver"] == null)
                {
                    this.CSSDayDisabledOver = "calendarDayDisabledOverDefault";
                }
                if (this.ViewState["CSSDaySelected"] == null)
                {
                    this.CSSDaySelected = "calendarDaySelectedDefault";
                }
                if (this.ViewState["CSSDaySelectedOver"] == null)
                {
                    this.CSSDaySelectedOver = "calendarDaySelectedOverDefault";
                }
                if (this.ViewState["CSSDaySpecial"] == null)
                {
                    this.CSSDaySpecial = "calendarDaySpecialDefault";
                }
                if (this.ViewState["CSSDaySpecialOver"] == null)
                {
                    this.CSSDaySpecialOver = "calendarDaySpecialOverDefault";
                }
                if (this.ViewState["CSSDatePickerButton"] == null)
                {
                    this.CSSDatePickerButton = "calendarDatePickerButtonDefault";
                }
            }
            StringBuilder builder = new StringBuilder();
            builder.Append("function initCalendar_" + this.ClientID + "(attempts) {");
            builder.Append("if(typeof(vdcCalendar) == \"undefined\")");
            builder.Append("{");
            builder.Append("if(attempts < 10)");
            builder.Append("{");
            builder.Append("window.setTimeout(\"initCalendar_" + this.ClientID + "(\" + (attempts+1) + \")\", 500);");
            builder.Append("}");
            builder.Append("else");
            builder.Append("{");
            if (this.ShowErrorAlert)
            {
                builder.Append("alert(\"There was a problem referencing Calendar javascript file.  Please contact vdccontrol@gmail.com for support.\");");
            }
            builder.Append("}");
            builder.Append("return;");
            builder.Append("}");
            builder.Append("try {");
            builder.Append("window." + this.ClientID + " = new vdcCalendar(");
            builder.Append("\"" + this.ClientID + "\",");
            builder.Append(this.Speed + ",");
            builder.Append(this.MonthWidth + ",");
            builder.Append(this.MonthHeight + ",");
            builder.Append(this.MonthMarginWidth + ",");
            builder.Append(this.Rows + ",");
            builder.Append(this.Columns + ",");
            builder.Append(string.Concat(new object[] { "new Date(", this.GetYear(this.DateFirstMonth), ",", this.GetMonth(this.DateFirstMonth) - 1, ",", this.GetDate(this.DateFirstMonth), ")," }));
            builder.Append(((this.DateMin == new DateTime(0L)) ? "null" : string.Concat(new object[] { "new Date(", this.DateMin.Year, ",", this.DateMin.Month - 1, ",", this.DateMin.Day, ")" })) + ",");
            builder.Append(((this.DateMax == new DateTime(0L)) ? "null" : string.Concat(new object[] { "new Date(", this.DateMax.Year, ",", this.DateMax.Month - 1, ",", this.DateMax.Day, ")" })) + ",");
            builder.Append(string.Concat(new object[] { "new Date(", this.GetYear(this.DateToday), ",", this.GetMonth(this.DateToday) - 1, ",", this.GetDate(this.DateToday), ")," }));
            builder.Append("\"" + this.FullMonthNames + "\",");
            builder.Append("\"" + this.ShortMonthNames + "\",");
            builder.Append("\"" + this.FullDayNames + "\",");
            builder.Append("\"" + this.ShortDayNames + "\",");
            builder.Append(this.ScrollBy + ",");
            builder.Append(str + ",");
            builder.Append(str3 + ",");
            builder.Append(str4 + ",");
            builder.Append(str2 + ",");
            builder.Append(str5 + ",");
            builder.Append(((this.SelectedDate == new DateTime(0L)) ? "null" : string.Concat(new object[] { "new Date(", this.GetYear(this.SelectedDate), ",", this.GetMonth(this.SelectedDate) - 1, ",", this.GetDate(this.SelectedDate), ",", this.GetHour(this.SelectedDate), ",", this.GetMinute(this.SelectedDate), ",", this.GetSecond(this.SelectedDate), ")" })) + ",");
            if (this.SelectedDates.Count > 0)
            {
                string str7 = "";
                for (int i = 0; i < this.SelectedDates.Count; i++)
                {
                    obj3 = str7;
                    str7 = string.Concat(new object[] { obj3, "new Date(", this.GetYear(this.SelectedDates[i]), ",", this.GetMonth(this.SelectedDates[i]) - 1, ",", this.GetDate(this.SelectedDates[i]), ",9,0,0)," });
                }
                builder.Append("[" + str7.Substring(0, str7.Length - 1) + "],");
            }
            else
            {
                builder.Append("[],");
            }
            builder.Append(((this.BeginDateCalendarId == string.Empty) ? "null" : ("\"" + this.BeginDateCalendarId + "\"")) + ",");
            builder.Append((this.DatePickerMode ? "true" : "false") + ",");
            builder.Append(this.OffsetLeft + ",");
            builder.Append(this.OffsetTop + ",");
            builder.Append("\"" + textBoxId + "\",");
            builder.Append("\"" + this.DateFormat + "\",");
            builder.Append("\"" + this.YearMonthFormat + "\",");
            builder.Append(this.FirstDayOfWeek + ",");
            builder.Append((this.ShowOtherMonthDays ? "true" : "false") + ",");
            builder.Append((this.AllowDeselect ? "true" : "false") + ",");
            builder.Append((this.AllowSelectSpecial ? "true" : "false") + ",");
            builder.Append((this.AllowSelectRegular ? "true" : "false") + ",");
            builder.Append(((this.EnabledDateExpression == string.Empty) ? "null" : ("\"" + this.EnabledDateExpression + "\"")) + ",");
            builder.Append((this.AutoPostBack ? ("\"" + this.Page.ClientScript.GetPostBackEventReference(this, "") + "\"") : "null") + ",");
            builder.Append((this.Enabled ? "true" : "false") + ",");
            builder.Append((this.DatePickerSynchronize ? "true" : "false") + ",");
            builder.Append(((this.MultiSelectedDates && !this.DatePickerMode) ? "true" : "false") + ",");
            builder.Append("\"" + this.CSSMonth + "\",");
            builder.Append("\"" + this.CSSMonthTitle + "\",");
            builder.Append("\"" + this.CSSDayName + "\",");
            builder.Append("\"" + this.CSSDay + "\",");
            builder.Append("\"" + this.CSSDayOver + "\",");
            builder.Append("\"" + this.CSSDayDisabled + "\",");
            builder.Append("\"" + this.CSSDayDisabledOver + "\",");
            builder.Append("\"" + this.CSSDaySpecial + "\",");
            builder.Append("\"" + this.CSSDaySpecialOver + "\",");
            builder.Append("\"" + this.CSSDayToday + "\",");
            builder.Append("\"" + this.CSSDayTodayOver + "\",");
            builder.Append("\"" + this.CSSDaySelected + "\",");
            builder.Append("\"" + this.CSSDaySelectedOver + "\",");
            builder.Append("\"" + this.CSSYearSelector + "\",");
            builder.Append("\"" + this.CSSYearSelected + "\",");
            builder.Append("\"" + this.CSSMonthSelector + "\",");
            builder.Append("\"" + this.CSSMonthSelected + "\",");
            builder.Append("\"" + this.CSSHourSelector + "\",");
            builder.Append("\"" + this.CSSHourSelected + "\",");
            builder.Append("\"" + this.CSSMinuteSelector + "\",");
            builder.Append("\"" + this.CSSMinuteSelected + "\",");
            builder.Append("\"" + this.CSSSecondSelector + "\",");
            builder.Append("\"" + this.CSSSecondSelected + "\",");
            builder.Append(this.YearSelectorScrollSpeed + ",");
            builder.Append(this.FirstYearSelectorScrollSpeed + ",");
            builder.Append(this.HourSelectorScrollSpeed + ",");
            builder.Append(this.FirstHourSelectorScrollSpeed + ",");
            builder.Append(this.MinuteSelectorScrollSpeed + ",");
            builder.Append(this.FirstMinuteSelectorScrollSpeed + ",");
            builder.Append(this.SecondSelectorScrollSpeed + ",");
            builder.Append(this.FirstSecondSelectorScrollSpeed + ",");
            builder.Append((this.ShowYearSelector ? "true" : "false") + ",");
            builder.Append((this.ShowMonthSelector ? "true" : "false") + ",");
            builder.Append("\"" + this.Align + "\",");
            builder.Append("\"" + this.TitleText + "\"");
            builder.Append(");");
            if (this.OnClientDateChanged != string.Empty)
            {
                builder.Append(this.ClientID + ".onClientDateChanged=" + this.OnClientDateChanged + ";");
            }
            if (this.OnClientDateMouseOver != string.Empty)
            {
                builder.Append(this.ClientID + ".onClientDateMouseOver=" + this.OnClientDateMouseOver + ";");
            }
            if (this.OnClientDateMouseOut != string.Empty)
            {
                builder.Append(this.ClientID + ".onClientDateMouseOut=" + this.OnClientDateMouseOut + ";");
            }
            if (this.OnClientMonthScrollLeft != string.Empty)
            {
                builder.Append(this.ClientID + ".onClientMonthScrollLeft=" + this.OnClientMonthScrollLeft + ";");
            }
            if (this.OnClientMonthScrollRight != string.Empty)
            {
                builder.Append(this.ClientID + ".onClientMonthScrollRight=" + this.OnClientMonthScrollRight + ";");
            }
            if (this.OnSwitchView != string.Empty)
            {
                builder.Append(this.ClientID + ".onClientSwitchView=" + this.OnSwitchView + ";");
            }
            builder.Append("} catch(e)");
            builder.Append("{");
            if (this.ShowErrorAlert)
            {
                builder.Append("alert(\"There was an error initializing Calendar with ID " + this.ClientID + ".\\n\\n\" + e.Message + \"\\n\\nPlease contact vdccontrol@gmail.com for help.\");");
            }
            builder.Append("}");
            builder.Append("}");
            builder.Append("initCalendar_" + this.ClientID + "(0);");
            if (this.BeginDateCalendarId != string.Empty)
            {
                builder.Append(this.BeginDateCalendarId + "endDate = " + this.ClientID + ";");
            }
            return builder.ToString();
        }

        private void deserializeCollection()
        {
            if ((this.ViewState["CalendarItems"] != null) && (this._items == null))
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml((string) this.ViewState["CalendarItems"]);
                if (document.DocumentElement.HasChildNodes)
                {
                    XmlNodeList childNodes = document.DocumentElement.ChildNodes;
                    for (int i = 0; i < childNodes.Count; i++)
                    {
                        SpecialDate newDate = new SpecialDate {
                            Year = int.Parse(childNodes[i].Attributes.GetNamedItem("year").Value),
                            Month = int.Parse(childNodes[i].Attributes.GetNamedItem("month").Value),
                            Day = int.Parse(childNodes[i].Attributes.GetNamedItem("day").Value),
                            ToolTip = childNodes[i].Attributes.GetNamedItem("tooltip").Value,
                            CSSClass = childNodes[i].Attributes.GetNamedItem("class").Value,
                            CSSClassOver = childNodes[i].Attributes.GetNamedItem("classover").Value
                        };
                        this.SpecialDates.Add(newDate);
                    }
                }
            }
        }

        private object findControl(Control where, Type type, string id)
        {
            if (where != null)
            {
                foreach (Control control in where.Controls)
                {
                    if (((control.GetType() == type) || (control.GetType().BaseType == type)) && ((control.ID == id) || (id == "")))
                    {
                        return control;
                    }
                    if (control.HasControls())
                    {
                        object obj2 = this.findControl(control, type, id);
                        if (obj2 != null)
                        {
                            return obj2;
                        }
                    }
                }
            }
            return null;
        }

        private int GetDate(DateTime date)
        {
            return new CultureInfo(this.CultureName).Calendar.GetDayOfMonth(date);
        }

        private int GetHour(DateTime date)
        {
            return new CultureInfo(this.CultureName).Calendar.GetHour(date);
        }

        private void GetMinMaxTime(int curTime, out int minTime, out int maxTime, bool isHour)
        {
            int num = 3;
            if (isHour)
            {
                if (curTime <= num)
                {
                    minTime = 0;
                    maxTime = minTime + (num * 2);
                }
                else if (curTime <= (0x17 - num))
                {
                    minTime = curTime - num;
                    maxTime = minTime + (num * 2);
                }
                else
                {
                    minTime = 0x17 - (num * 2);
                    maxTime = minTime + (num * 2);
                }
            }
            else if (curTime <= num)
            {
                minTime = 0;
                maxTime = minTime + (num * 2);
            }
            else if (curTime <= (0x3b - num))
            {
                minTime = curTime - num;
                maxTime = minTime + (num * 2);
            }
            else
            {
                minTime = 0x3b - (num * 2);
                maxTime = minTime + (num * 2);
            }
        }

        private int GetMinute(DateTime date)
        {
            return new CultureInfo(this.CultureName).Calendar.GetMinute(date);
        }

        private int GetMonth(DateTime date)
        {
            return new CultureInfo(this.CultureName).Calendar.GetMonth(date);
        }

        private string GetMonthSelector()
        {
            int num;
            if (!this.ShowMonthSelector)
            {
                return string.Empty;
            }
            string str = "";
            switch (this.MonthSelectorType)
            {
                case SelectorType.DropDownList:
                    str = "<select id=\"_" + this.ClientID + "Month\" onChange=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".selectMonth(' + parseInt(this.options[this.selectedIndex].value,10) + ');');\">";
                    for (num = 0; num < 12; num++)
                    {
                        object obj2;
                        if (num == (this.GetMonth(this.DateFirstMonth) - 1))
                        {
                            obj2 = str;
                            str = string.Concat(new object[] { obj2, "<option value=\"", num, "\" selected=\"true\">", this.FullMonthNames.Split(new char[] { ',' })[num], "</option>" });
                        }
                        else
                        {
                            obj2 = str;
                            str = string.Concat(new object[] { obj2, "<option value=\"", num, "\">", this.FullMonthNames.Split(new char[] { ',' })[num], "</option>" });
                        }
                    }
                    return (str + "</select>");

                case SelectorType.HtmlList:
                    str = "<div id=\"" + this.ClientID + "_MonthSelectorTitle\" class=\"" + this.CSSMonthSelectorTitle + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".displayMonthSelector()')\">";
                    for (num = 0; num < 12; num++)
                    {
                        if (num == (this.GetMonth(this.DateFirstMonth) - 1))
                        {
                            str = str + this.FullMonthNames.Split(new char[] { ',' })[num];
                        }
                    }
                    return (str + "</div>");
            }
            return str;
        }

        private string GetMonthSelectorContainer()
        {
            if (!this.ShowMonthSelector)
            {
                return string.Empty;
            }
            string str = "";
            if (this.MonthSelectorType == SelectorType.HtmlList)
            {
                string str3 = str + "<div>";
                str = str3 + "<table cellpadding=\"0\" cellspacing=\"0\" onclick=\"" + this.ClientID + ".knackerevent(event)\" id=\"" + this.ClientID + "_MonthSelectorContainer\"  class=\"" + this.CSSMonthSelectorContainer + "\">";
                for (int i = 0; i < 12; i++)
                {
                    object obj2;
                    if (i == (this.GetMonth(this.DateFirstMonth) - 1))
                    {
                        obj2 = str;
                        str = string.Concat(new object[] { 
                            obj2, "<tr month=\"", i, "\" id=\"", this.ClientID, "_Month", i, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectMonth(", i, ")')\" class=\"", this.CSSMonthSelected, "\"><td>", 
                            this.FullMonthNames.Split(new char[] { ',' })[i], "</td></tr>"
                         });
                    }
                    else
                    {
                        obj2 = str;
                        str = string.Concat(new object[] { 
                            obj2, "<tr month=\"", i, "\" id=\"", this.ClientID, "_Month", i, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectMonth(", i, ")')\" class=\"", this.CSSMonthSelector, "\" onmouseover=\"", 
                            this.ClientID, ".setMonthSelectorOverEffect(this, '", this.CSSMonthSelected, "');\" onmouseout=\"", this.ClientID, ".setMonthSelectorOverEffect(this, '", this.CSSMonthSelector, "');\"><td>", this.FullMonthNames.Split(new char[] { ',' })[i], "</td></tr>"
                         });
                    }
                }
                str = ((str + "</table>") + "<iframe id=\"_" + this.ClientID + "_MonthSelectorIframe\" style=\"display:none;position:absolute;left:0px;top:0px;\" src=\"javascript:false;\" frameBorder=\"0\" scrolling=\"no\"></iframe>") + "</div>";
            }
            return str;
        }

        private int GetSecond(DateTime date)
        {
            return new CultureInfo(this.CultureName).Calendar.GetSecond(date);
        }

        private string GetTimeSelector()
        {
            if (!this.ShowTimeSelector)
            {
                return string.Empty;
            }
            StringBuilder builder = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            StringBuilder builder3 = new StringBuilder();
            StringBuilder builder4 = new StringBuilder();
            builder.Append("<div style=\"text-align:center;width:100%;\">");
            switch (this.TimeSelectorType)
            {
                case SelectorType.DropDownList:
                {
                    int num = 0;
                    while (num < 60)
                    {
                        if (num == this.SelectedDate.Minute)
                        {
                            string introduced15 = num.ToString();
                            builder2.Append(string.Format("<option selected='true' value='{0}'>{1}</option>", introduced15, num.ToString("#00")));
                        }
                        else
                        {
                            string introduced16 = num.ToString();
                            builder2.Append(string.Format("<option value='{0}'>{1}</option>", introduced16, num.ToString("#00")));
                        }
                        if (num == this.SelectedDate.Second)
                        {
                            string introduced17 = num.ToString();
                            builder3.Append(string.Format("<option selected='true' value='{0}'>{1}</option>", introduced17, num.ToString("#00")));
                        }
                        else
                        {
                            string introduced18 = num.ToString();
                            builder3.Append(string.Format("<option value='{0}'>{1}</option>", introduced18, num.ToString("#00")));
                        }
                        num++;
                    }
                    for (num = 0; num < 0x18; num++)
                    {
                        if (num == this.SelectedDate.Hour)
                        {
                            string introduced19 = num.ToString();
                            builder4.Append(string.Format("<option selected='true' value='{0}'>{1}</option>", introduced19, num.ToString("#00")));
                        }
                        else
                        {
                            string introduced20 = num.ToString();
                            builder4.Append(string.Format("<option value='{0}'>{1}</option>", introduced20, num.ToString("#00")));
                        }
                    }
                    if (this.ShowHourSelector)
                    {
                        builder.Append(string.Concat(new object[] { "<select onchange=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectHour(' + parseInt(this.options[this.selectedIndex].value,10) + ')')\" id='_", this.ClientID, "Hour'>", builder4, "</select>" }));
                    }
                    if (this.ShowMinuteSelector)
                    {
                        if (this.ShowHourSelector)
                        {
                            builder.Append(":");
                        }
                        builder.Append(string.Concat(new object[] { "<select onchange=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectMinute(' + parseInt(this.options[this.selectedIndex].value,10) + ')')\" id='_", this.ClientID, "Minute'>", builder2, "</select>" }));
                    }
                    if (this.ShowSecondSelector)
                    {
                        if (this.ShowHourSelector || this.ShowMinuteSelector)
                        {
                            builder.Append(":");
                        }
                        builder.Append(string.Concat(new object[] { "<select onchange=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectSecond(' + parseInt(this.options[this.selectedIndex].value,10) + ')')\" id='_", this.ClientID, "Second'>", builder3, "</select>" }));
                    }
                    break;
                }
                case SelectorType.HtmlList:
                    builder4.Append("<div style=\"display:inline;\" id=\"" + this.ClientID + "_HourSelectorTitle\" class=\"" + this.CSSHourSelectorTitle + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".displayHourSelector()')\">");
                    for (int i = 0; i <= 0x18; i++)
                    {
                        if (i == this.SelectedDate.Hour)
                        {
                            builder4.Append(i.ToString("#00"));
                        }
                    }
                    builder4.Append("</div>");
                    builder2.Append("<div style=\"display:inline;\" id=\"" + this.ClientID + "_MinuteSelectorTitle\" class=\"" + this.CSSMinuteSelectorTitle + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".displayMinuteSelector()')\">");
                    for (int j = 0; j <= 0x3b; j++)
                    {
                        if (j == this.SelectedDate.Minute)
                        {
                            builder2.Append(j.ToString("#00"));
                        }
                    }
                    builder2.Append("</div>");
                    builder3.Append("<div style=\"display:inline;\" id=\"" + this.ClientID + "_SecondSelectorTitle\" class=\"" + this.CSSSecondSelectorTitle + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".displaySecondSelector()')\">");
                    for (int k = 0; k <= 0x3b; k++)
                    {
                        if (k == this.SelectedDate.Second)
                        {
                            builder3.Append(k.ToString("#00"));
                        }
                    }
                    builder3.Append("</div>");
                    if (this.ShowHourSelector)
                    {
                        builder.Append(builder4);
                    }
                    if (this.ShowMinuteSelector)
                    {
                        if (this.ShowHourSelector)
                        {
                            builder.Append(":");
                        }
                        builder.Append(builder2);
                    }
                    if (this.ShowSecondSelector)
                    {
                        if (this.ShowHourSelector || this.ShowMinuteSelector)
                        {
                            builder.Append(":");
                        }
                        builder.Append(builder3);
                    }
                    break;
            }
            if (this.DatePickerMode && ((this.ShowHourSelector || this.ShowMinuteSelector) || this.ShowSecondSelector))
            {
                string str = "<a class=\"" + this.CSSSelectTime + "\" href=\"javascript:" + this.ClientID + ".addToQueue('" + this.ClientID + ".selectTime()')\">" + this.TextSelectTime + "</a>";
                builder.Append(str);
            }
            builder.Append("</div>");
            return builder.ToString();
        }

        private string GetTimeSelectorContainer()
        {
            if (!this.ShowTimeSelector)
            {
                return string.Empty;
            }
            StringBuilder builder = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            StringBuilder builder3 = new StringBuilder();
            StringBuilder builder4 = new StringBuilder();
            if (this.TimeSelectorType == SelectorType.HtmlList)
            {
                int minTime = 0;
                int maxTime = 0;
                builder4.Append("<div>");
                builder4.Append("<table cellpadding=\"0\" cellspacing=\"0\" onclick=\"" + this.ClientID + ".knackerevent(event)\" id=\"" + this.ClientID + "_HourSelectorContainer\"  class=\"" + this.CSSHourSelectorContainer + "\">");
                builder4.Append("<tr><td onmousedown=\"" + this.ClientID + ".hourSelectorMoveUpScroll('start')\" onmouseup=\"" + this.ClientID + ".hourSelectorMoveUpScroll('end')\" id=\"" + this.ClientID + "_HourSelectorMoveUp\" class=\"" + this.CSSHourSelectorArrowUp + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".hourSelectorMoveUp()');\">&nbsp;</td></tr>");
                this.GetMinMaxTime(this.SelectedDate.Hour, out minTime, out maxTime, true);
                for (int i = 0; i <= 0x17; i++)
                {
                    if (i == this.SelectedDate.Hour)
                    {
                        builder4.Append(string.Concat(new object[] { 
                            "<tr hour=\"", i, "\" id=\"", this.ClientID, "_Hour", i, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectHour(", i, ")')\" class=\"", this.CSSHourSelected, "\"><td>", i.ToString("#00"), 
                            "</td></tr>"
                         }));
                    }
                    else if ((i <= maxTime) && (i >= minTime))
                    {
                        builder4.Append(string.Concat(new object[] { 
                            "<tr hour=\"", i, "\" id=\"", this.ClientID, "_Hour", i, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectHour(", i, ")')\" class=\"", this.CSSHourSelector, "\" onmouseover=\"", this.ClientID, 
                            ".setHourSelectorOverEffect(this, '", this.CSSHourSelected, "');\" onmouseout=\"", this.ClientID, ".setHourSelectorOverEffect(this, '", this.CSSHourSelector, "');\"><td>", i.ToString("#00"), "</td></tr>"
                         }));
                    }
                    else
                    {
                        builder4.Append(string.Concat(new object[] { 
                            "<tr hour=\"", i, "\" style=\"display:none\" id=\"", this.ClientID, "_Hour", i, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectHour(", i, ")')\" class=\"", this.CSSHourSelector, "\" onmouseover=\"", this.ClientID, 
                            ".setHourSelectorOverEffect(this, '", this.CSSHourSelected, "');\" onmouseout=\"", this.ClientID, ".setHourSelectorOverEffect(this, '", this.CSSHourSelector, "');\"><td>", i.ToString("#00"), "</td></tr>"
                         }));
                    }
                }
                builder4.Append("<tr><td onmousedown=\"" + this.ClientID + ".hourSelectorMoveDownScroll('start')\" onmouseup=\"" + this.ClientID + ".hourSelectorMoveDownScroll('end')\" id=\"" + this.ClientID + "_HourSelectorMoveDown\" class=\"" + this.CSSHourSelectorArrowDown + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".hourSelectorMoveDown()');\">&nbsp;</td></tr>");
                builder4.Append("</table>");
                builder4.Append("<iframe id=\"_" + this.ClientID + "_HourSelectorIframe\" style=\"display:none;position:absolute;left:0px;top:0px;\" src=\"javascript:false;\" frameBorder=\"0\" scrolling=\"no\"></iframe>");
                builder4.Append("</div>");
                builder2.Append("<div>");
                builder2.Append("<table cellpadding=\"0\" cellspacing=\"0\" onclick=\"" + this.ClientID + ".knackerevent(event)\" id=\"" + this.ClientID + "_MinuteSelectorContainer\"  class=\"" + this.CSSMinuteSelectorContainer + "\">");
                builder2.Append("<tr><td onmousedown=\"" + this.ClientID + ".minuteSelectorMoveUpScroll('start')\" onmouseup=\"" + this.ClientID + ".minuteSelectorMoveUpScroll('end')\" id=\"" + this.ClientID + "_MinuteSelectorMoveUp\" class=\"" + this.CSSMinuteSelectorArrowUp + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".minuteSelectorMoveUp()');\">&nbsp;</td></tr>");
                this.GetMinMaxTime(this.SelectedDate.Minute, out minTime, out maxTime, false);
                for (int j = 0; j <= 0x3b; j++)
                {
                    if (j == this.SelectedDate.Minute)
                    {
                        builder2.Append(string.Concat(new object[] { 
                            "<tr minute=\"", j, "\" id=\"", this.ClientID, "_Minute", j, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectMinute(", j, ")')\" class=\"", this.CSSMinuteSelected, "\"><td>", j.ToString("#00"), 
                            "</td></tr>"
                         }));
                    }
                    else if ((j <= maxTime) && (j >= minTime))
                    {
                        builder2.Append(string.Concat(new object[] { 
                            "<tr minute=\"", j, "\" id=\"", this.ClientID, "_Minute", j, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectMinute(", j, ")')\" class=\"", this.CSSMinuteSelector, "\" onmouseover=\"", this.ClientID, 
                            ".setMinuteSelectorOverEffect(this, '", this.CSSMinuteSelected, "');\" onmouseout=\"", this.ClientID, ".setMinuteSelectorOverEffect(this, '", this.CSSMinuteSelector, "');\"><td>", j.ToString("#00"), "</td></tr>"
                         }));
                    }
                    else
                    {
                        builder2.Append(string.Concat(new object[] { 
                            "<tr minute=\"", j, "\" style=\"display:none\" id=\"", this.ClientID, "_Minute", j, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectMinute(", j, ")')\" class=\"", this.CSSMinuteSelector, "\" onmouseover=\"", this.ClientID, 
                            ".setMinuteSelectorOverEffect(this, '", this.CSSMinuteSelected, "');\" onmouseout=\"", this.ClientID, ".setMinuteSelectorOverEffect(this, '", this.CSSMinuteSelector, "');\"><td>", j.ToString("#00"), "</td></tr>"
                         }));
                    }
                }
                builder2.Append("<tr><td onmousedown=\"" + this.ClientID + ".minuteSelectorMoveDownScroll('start')\" onmouseup=\"" + this.ClientID + ".minuteSelectorMoveDownScroll('end')\" id=\"" + this.ClientID + "_MinuteSelectorMoveDown\" class=\"" + this.CSSMinuteSelectorArrowDown + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".minuteSelectorMoveDown()');\">&nbsp;</td></tr>");
                builder2.Append("</table>");
                builder2.Append("<iframe id=\"_" + this.ClientID + "_MinuteSelectorIframe\" style=\"display:none;position:absolute;left:0px;top:0px;\" src=\"javascript:false;\" frameBorder=\"0\" scrolling=\"no\"></iframe>");
                builder2.Append("</div>");
                builder3.Append("<div>");
                builder3.Append("<table cellpadding=\"0\" cellspacing=\"0\" onclick=\"" + this.ClientID + ".knackerevent(event)\" id=\"" + this.ClientID + "_SecondSelectorContainer\"  class=\"" + this.CSSSecondSelectorContainer + "\">");
                builder3.Append("<tr><td onmousedown=\"" + this.ClientID + ".secondSelectorMoveUpScroll('start')\" onmouseup=\"" + this.ClientID + ".secondSelectorMoveUpScroll('end')\" id=\"" + this.ClientID + "_SecondSelectorMoveUp\" class=\"" + this.CSSSecondSelectorArrowUp + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".secondSelectorMoveUp()');\">&nbsp;</td></tr>");
                this.GetMinMaxTime(this.SelectedDate.Second, out minTime, out maxTime, false);
                for (int k = 0; k <= 0x3b; k++)
                {
                    if (k == this.SelectedDate.Second)
                    {
                        builder3.Append(string.Concat(new object[] { 
                            "<tr second=\"", k, "\" id=\"", this.ClientID, "_Second", k, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectSecond(", k, ")')\" class=\"", this.CSSSecondSelected, "\"><td>", k.ToString("#00"), 
                            "</td></tr>"
                         }));
                    }
                    else if ((k <= maxTime) && (k >= minTime))
                    {
                        builder3.Append(string.Concat(new object[] { 
                            "<tr second=\"", k, "\" id=\"", this.ClientID, "_Second", k, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectSecond(", k, ")')\" class=\"", this.CSSSecondSelector, "\" onmouseover=\"", this.ClientID, 
                            ".setSecondSelectorOverEffect(this, '", this.CSSSecondSelected, "');\" onmouseout=\"", this.ClientID, ".setSecondSelectorOverEffect(this, '", this.CSSSecondSelector, "');\"><td>", k.ToString("#00"), "</td></tr>"
                         }));
                    }
                    else
                    {
                        builder3.Append(string.Concat(new object[] { 
                            "<tr second=\"", k, "\" style=\"display:none\" id=\"", this.ClientID, "_Second", k, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectSecond(", k, ")')\" class=\"", this.CSSSecondSelector, "\" onmouseover=\"", this.ClientID, 
                            ".setSecondSelectorOverEffect(this, '", this.CSSSecondSelected, "');\" onmouseout=\"", this.ClientID, ".setSecondSelectorOverEffect(this, '", this.CSSSecondSelector, "');\"><td>", k.ToString("#00"), "</td></tr>"
                         }));
                    }
                }
                builder3.Append("<tr><td onmousedown=\"" + this.ClientID + ".secondSelectorMoveDownScroll('start')\" onmouseup=\"" + this.ClientID + ".secondSelectorMoveDownScroll('end')\" id=\"" + this.ClientID + "_SecondSelectorMoveDown\" class=\"" + this.CSSSecondSelectorArrowDown + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".secondSelectorMoveDown()');\">&nbsp;</td></tr>");
                builder3.Append("</table>");
                builder3.Append("<iframe id=\"_" + this.ClientID + "_SecondSelectorIframe\" style=\"display:none;position:absolute;left:0px;top:0px;\" src=\"javascript:false;\" frameBorder=\"0\" scrolling=\"no\"></iframe>");
                builder3.Append("</div>");
                if (this.ShowHourSelector)
                {
                    builder.Append(builder4);
                }
                if (this.ShowMinuteSelector)
                {
                    builder.Append(builder2);
                }
                if (this.ShowSecondSelector)
                {
                    builder.Append(builder3);
                }
            }
            return builder.ToString();
        }

        private int GetYear(DateTime date)
        {
            if (!(this.Page.IsPostBack && !(this.SelectedDate == new DateTime(0L))))
            {
                return new CultureInfo(this.CultureName).Calendar.GetYear(date);
            }
            return date.Year;
        }

        private string GetYearSelector()
        {
            int num;
            int num2;
            if (!this.ShowYearSelector)
            {
                return string.Empty;
            }
            string str = "";
            switch (this.YearSelectorType)
            {
                case SelectorType.DropDownList:
                    str = "<select id=\"_" + this.ClientID + "Year\" onChange=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".selectYear(' + parseInt(this.options[this.selectedIndex].value,10) + ');');\">";
                    num = (this.DateMin == new DateTime(0L)) ? (this.GetYear(this.DateFirstMonth) - 10) : this.DateMin.Year;
                    num2 = (this.DateMax == new DateTime(0L)) ? (this.GetYear(this.DateFirstMonth) + 10) : this.DateMax.Year;
                    while (num <= num2)
                    {
                        object obj2;
                        if (num == this.GetYear(this.DateFirstMonth))
                        {
                            obj2 = str;
                            str = string.Concat(new object[] { obj2, "<option value=\"", num, "\" selected=\"true\">", num, "</option>" });
                        }
                        else
                        {
                            obj2 = str;
                            str = string.Concat(new object[] { obj2, "<option value=\"", num, "\">", num, "</option>" });
                        }
                        num++;
                    }
                    return (str + "</select>");

                case SelectorType.HtmlList:
                    this.YearSelectorMinMaxYear(out num, out num2);
                    str = "<div id=\"" + this.ClientID + "_YearSelectorTitle\" minYear=\"" + num.ToString() + "\" maxYear=\"" + num2.ToString() + "\" class=\"" + this.CSSYearSelectorTitle + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".displayYearSelector()')\">";
                    for (int i = num; i <= num2; i++)
                    {
                        if (i == this.GetYear(this.DateFirstMonth))
                        {
                            str = str + i;
                        }
                    }
                    return (str + "</div>");
            }
            return str;
        }

        private string GetYearSelectorContainer()
        {
            if (!this.ShowYearSelector)
            {
                return string.Empty;
            }
            string str = "";
            if (this.YearSelectorType == SelectorType.HtmlList)
            {
                int num;
                int num2;
                int num3;
                int num4;
                this.YearSelectorMinMaxYear(out num, out num2, out num3, out num4);
                string str3 = str + "<div>";
                str3 = str3 + "<table cellpadding=\"0\" cellspacing=\"0\" onclick=\"" + this.ClientID + ".knackerevent(event)\" id=\"" + this.ClientID + "_YearSelectorContainer\"  class=\"" + this.CSSYearSelectorContainer + "\">";
                str = str3 + "<tr><td onmousedown=\"" + this.ClientID + ".yearSelectorMoveUpScroll('start')\" onmouseup=\"" + this.ClientID + ".yearSelectorMoveUpScroll('end')\" id=\"" + this.ClientID + "_YearSelectorMoveUp\" class=\"" + this.CSSYearSelectorArrowUp + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".yearSelectorMoveUp()');\">&nbsp;</td></tr>";
                for (int i = num; i <= num2; i++)
                {
                    object obj2;
                    if (i == this.GetYear(this.DateFirstMonth))
                    {
                        obj2 = str;
                        str = string.Concat(new object[] { 
                            obj2, "<tr year=\"", i, "\" id=\"", this.ClientID, "_Year", i, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectYear(", i, ")')\" class=\"", this.CSSYearSelected, "\"><td>", 
                            i, "</td></tr>"
                         });
                    }
                    else if ((i <= num4) && (i >= num3))
                    {
                        obj2 = str;
                        str = string.Concat(new object[] { 
                            obj2, "<tr year=\"", i, "\" id=\"", this.ClientID, "_Year", i, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectYear(", i, ")')\" class=\"", this.CSSYearSelector, "\" onmouseover=\"", 
                            this.ClientID, ".setYearSelectorOverEffect(this, '", this.CSSYearSelected, "');\" onmouseout=\"", this.ClientID, ".setYearSelectorOverEffect(this, '", this.CSSYearSelector, "');\"><td>", i, "</td></tr>"
                         });
                    }
                    else
                    {
                        obj2 = str;
                        str = string.Concat(new object[] { 
                            obj2, "<tr year=\"", i, "\" style=\"display:none\" id=\"", this.ClientID, "_Year", i, "\" onclick=\"", this.ClientID, ".addToQueue('", this.ClientID, ".selectYear(", i, ")')\" class=\"", this.CSSYearSelector, "\" onmouseover=\"", 
                            this.ClientID, ".setYearSelectorOverEffect(this, '", this.CSSYearSelected, "');\" onmouseout=\"", this.ClientID, ".setYearSelectorOverEffect(this, '", this.CSSYearSelector, "');\"><td>", i, "</td></tr>"
                         });
                    }
                }
                str3 = str;
                str = (((str3 + "<tr><td onmousedown=\"" + this.ClientID + ".yearSelectorMoveDownScroll('start')\" onmouseup=\"" + this.ClientID + ".yearSelectorMoveDownScroll('end')\" id=\"" + this.ClientID + "_YearSelectorMoveDown\" class=\"" + this.CSSYearSelectorArrowDown + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".yearSelectorMoveDown()');\">&nbsp;</td></tr>") + "</table>") + "<iframe id=\"_" + this.ClientID + "_YearSelectorIframe\" style=\"display:none;position:absolute;left:0px;top:0px;\" src=\"javascript:false;\" frameBorder=\"0\" scrolling=\"no\"></iframe>") + "</div>";
            }
            return str;
        }

        public bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            this.SelectedDates.Clear();
            string str = postCollection["sd_" + this.ClientID];
            if (((str != null) && (str.Length > 0)) && (str != ","))
            {
                string[] strArray = str.Replace(",", "").Split(new char[] { ';' });
                if (strArray.Length > 0)
                {
                    for (int i = 0; i < strArray.Length; i++)
                    {
                        string[] strArray2 = strArray[i].Split(new char[] { '.' });
                        DateTime date = new DateTime(int.Parse(strArray2[0]), int.Parse(strArray2[1]), int.Parse(strArray2[2]));
                        this.SelectedDates.Add(date);
                    }
                }
            }
            string str2 = postCollection["h_" + this.ClientID];
            if ((str2 == null) || (str2.Length == 0))
            {
                return false;
            }
            str2 = str2.Replace(",", "");
            string[] strArray3 = str2.Split(new char[] { ';' });
            if (strArray3.Length < 2)
            {
                return false;
            }
            string[] strArray4 = strArray3[1].Split(new char[] { '.' });
            if (strArray4.Length < 3)
            {
                throw new Exception(" Calendar LoadPostData.  Invalid date from postback.  firstMonth.");
            }
            if (str2.StartsWith("0"))
            {
                this.SelectedDate = new DateTime(0L);
                this.DateFirstMonth = new DateTime(int.Parse(strArray4[0]), int.Parse(strArray4[1]), int.Parse(strArray4[2]));
                return true;
            }
            string[] strArray5 = strArray3[0].Split(new char[] { '.' });
            if (strArray5.Length < 3)
            {
                throw new Exception("Calendar LoadPostData.  Invalid date from postback: selectedDate.");
            }
            if (strArray3.Length == 3)
            {
                string[] strArray6 = strArray3[2].Split(new char[] { '.' });
                if (strArray6.Length < 3)
                {
                    throw new Exception("Calendar LoadPostData.  Invalid date from postback: selectedDate.");
                }
                this.SelectedDate = new DateTime(int.Parse(strArray5[0]), int.Parse(strArray5[1]), int.Parse(strArray5[2]), int.Parse(strArray6[0]), int.Parse(strArray6[1]), int.Parse(strArray6[2]));
            }
            else
            {
                this.SelectedDate = new DateTime(int.Parse(strArray5[0]), int.Parse(strArray5[1]), int.Parse(strArray5[2]));
            }
            this.DateFirstMonth = new DateTime(int.Parse(strArray4[0]), int.Parse(strArray4[1]), int.Parse(strArray4[2]));
            return true;
        }

        protected override void LoadViewState(object savedState)
        {
            base.LoadViewState(savedState);
            this.deserializeCollection();
        }

        protected override bool OnBubbleEvent(object source, EventArgs args)
        {
            return true;
        }

        protected virtual void OnDateChanged(EventArgs e)
        {
            DateChangedEventHandler handler = (DateChangedEventHandler) base.Events[EventDateChanged];
            if (handler != null)
            {
                handler(this, e);
            }
        }

        protected override void OnPreRender(EventArgs e)
        {
            this.IsDefaultStyleRendered = false;
            if (!this.IsDefaultStyleRendered)
            {
                this.Page.Unload += new EventHandler(this.Page_Unload);
            }
            ScriptManagerHelper helper = new ScriptManagerHelper(this);
            helper.RegisterHiddenField(this, "h_" + this.ClientID, "");
            helper.RegisterHiddenField(this, "sd_" + this.ClientID, "");
            this.Page.RegisterRequiresPostBack(this);
            if (this.BeginDateCalendarId != string.Empty)
            {
                Vdc.Calendar2.Calendar calendar = (Vdc.Calendar2.Calendar)this.findControl(this.NamingContainer, base.GetType(), this.BeginDateCalendarId);
                if (calendar != null)
                {
                    this.BeginDateCalendarId = calendar.ClientID;
                    if ((this.DateMin == new DateTime(0L)) || (calendar.DateMin <= this.DateMin))
                    {
                        this.DateMin = calendar.DateMin;
                    }
                    else
                    {
                        calendar.DateMin = this.DateMin;
                    }
                    if ((this.DateMax == new DateTime(0L)) || (calendar.DateMax >= this.DateMax))
                    {
                        this.DateMax = calendar.DateMax;
                    }
                    else
                    {
                        calendar.DateMax = this.DateMax;
                    }
                }
            }
            base.OnPreRender(e);
        }

        private void Page_Unload(object sender, EventArgs e)
        {
            this.IsDefaultStyleRendered = false;
        }

        public void RaisePostBackEvent(string eventArgument)
        {
            if (!this._eventHandlerCalled)
            {
                this.OnDateChanged(EventArgs.Empty);
                this._eventHandlerCalled = true;
            }
        }

        public void RaisePostDataChangedEvent()
        {
            if (!this._eventHandlerCalled)
            {
                this.OnDateChanged(EventArgs.Empty);
                this._eventHandlerCalled = true;
            }
        }

        public void RemoveAllSpecialDates()
        {
            this.SpecialDates.Clear();
        }

        public void RemoveSpecialDate(DateTime data)
        {
            this.SpecialDates.Remove(new SpecialDate(data));
        }

        public void RemoveSpecialDate(int index)
        {
            this.SpecialDates.Remove(index);
        }

        public void RemoveSpecialDate(int Year, int Month, int Day)
        {
            this.SpecialDates.Remove(new SpecialDate(Year, Month, Day));
        }

        protected override void Render(HtmlTextWriter writer)
        {
            string cSSPath;
            ScriptManagerHelper helper = new ScriptManagerHelper(this);
            string script = this.createScript();
            this._inForm = true;
            try
            {
                this.Page.VerifyRenderingInServerForm(this);
            }
            catch
            {
                this._inForm = false;
            }
            writer.WriteLine("<span style=\"display:none\">&nbsp;</span>");
            if (!this.DisableEmbeddedScriptFileResource)
            {
                string webResourceUrl = this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "Vdc.Calendar2.Resources.vdcCalendar2.min.js");
                if (helper.IsAjax && helper.IsInAsyncCallback)
                {
                    helper.RegisterClientScriptResource(this, "Vdc.Calendar2.Resources.vdcCalendar2.min.js");
                }
                else
                {
                    writer.WriteLine("<script language=\"javascript\" src=\"" + webResourceUrl + "\"></script>");
                }
            }
            if (this.StyleFolder != string.Empty)
            {
                cSSPath = Path.Combine(this.StyleFolder, "style.css").Replace(@"\", "/");
                cSSPath = base.ResolveUrl(cSSPath);
                writer.Write("<link rel=\"stylesheet\" href=\"" + cSSPath + "\" display=\"all\" />");
            }
            else if (this.CSSPath != string.Empty)
            {
                cSSPath = this.CSSPath;
                cSSPath = base.ResolveUrl(cSSPath);
                writer.Write("<link rel=\"stylesheet\" href=\"" + this.CSSPath + "\" display=\"all\" />");
            }
            else if (!this.IsDefaultStyleRendered)
            {
                string str4 = this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "Vdc.Calendar2.Resources.arrowUp.gif");
                string str5 = this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "Vdc.Calendar2.Resources.arrowDown.gif");
                writer.Write("<style type=\"text/css\">\n");
                writer.Write(".calendarCalendarDefault {border:1px solid #999999;background-color:#FFFFFF;text-align:left;}\n");
                writer.Write(".calendarTitleDefault {font:bold 12px Tahoma;color:#333333;text-align:center;padding-bottom:6px;padding-top:2px;}\n");
                writer.Write(".calendarYearSelectorTitleDefault {cursor:pointer;display:inline;padding-left:5px;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarYearSelectorContainerDefault {border:1px solid #999999;padding-left:5px;padding-right:5px;display:none;background-color:#ffffff;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarYearSelectorArrowUpDefault {cursor:pointer;background:url('" + str4 + "');background-repeat:no-repeat;background-position:center;text-align:center;}\n");
                writer.Write(".calendarYearSelectorArrowDownDefault {cursor:pointer;background:url('" + str5 + "');background-repeat:no-repeat;background-position:center;text-align:center;}\n");
                writer.Write(".calendarYearSelectedDefault {cursor:pointer;font:bold 12px Tahoma;text-align:center;background-color:#333333;color:#ffffff}\n");
                writer.Write(".calendarYearDefault {cursor:pointer;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarMonthSelectorTitleDefault {cursor:pointer;display:inline;padding-left:5px;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarMonthSelectorContainerDefault {border:1px solid #999999;padding-left:5px;padding-right:5px;display:none;background-color:#ffffff;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarMonthSelectedDefault {cursor:pointer;font:bold 12px Tahoma;text-align:center;background-color:#333333;color:#ffffff}\n");
                writer.Write(".calendarMonthDefault {cursor:pointer;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarSelectTimeDefault {cursor:pointer;font:bold 12px Tahoma;color:#000000;padding:5px;text-decoration:none;text-align:center;}\n");
                writer.Write(".calendarSelectTimeDefault:hover {cursor:pointer;font:bold 12px Tahoma;color:#000000;padding:5px;text-decoration:none;text-align:center;}\n");
                writer.Write(".calendarHourSelectorTitleDefault {cursor:pointer;display:inline;padding-left:3px;padding-right:3px;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarHourSelectorContainerDefault {border:1px solid #999999;padding-left:3px;padding-right:3px;display:none;background-color:#ffffff;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarHourSelectorArrowUpDefault {cursor:pointer;background:url('" + str4 + "');background-repeat:no-repeat;background-position:center;text-align:center;}\n");
                writer.Write(".calendarHourSelectorArrowDownDefault {cursor:pointer;background:url('" + str5 + "');background-repeat:no-repeat;background-position:center;text-align:center;}\n");
                writer.Write(".calendarHourSelectedDefault {cursor:pointer;font:bold 12px Tahoma;text-align:center;background-color:#333333;color:#ffffff}\n");
                writer.Write(".calendarHourDefault {cursor:pointer;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarMinuteSelectorTitleDefault {cursor:pointer;display:inline;padding-left:3px;padding-right:3px;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarMinuteSelectorContainerDefault {border:1px solid #999999;padding-left:3px;padding-right:3px;display:none;background-color:#ffffff;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarMinuteSelectorArrowUpDefault {cursor:pointer;background:url('" + str4 + "');background-repeat:no-repeat;background-position:center;text-align:center;}\n");
                writer.Write(".calendarMinuteSelectorArrowDownDefault {cursor:pointer;background:url('" + str5 + "');background-repeat:no-repeat;background-position:center;text-align:center;}\n");
                writer.Write(".calendarMinuteSelectedDefault {cursor:pointer;font:bold 12px Tahoma;text-align:center;background-color:#333333;color:#ffffff}\n");
                writer.Write(".calendarMinuteDefault {cursor:pointer;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarSecondSelectorTitleDefault {cursor:pointer;display:inline;padding-left:3px;padding-right:3px;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarSecondSelectorContainerDefault {border:1px solid #999999;padding-left:3px;padding-right:3px;display:none;background-color:#ffffff;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarSecondSelectorArrowUpDefault {cursor:pointer;background:url('" + str4 + "');background-repeat:no-repeat;background-position:center;text-align:center;}\n");
                writer.Write(".calendarSecondSelectorArrowDownDefault {cursor:pointer;background:url('" + str5 + "');background-repeat:no-repeat;background-position:center;text-align:center;}\n");
                writer.Write(".calendarSecondSelectedDefault {cursor:pointer;font:bold 12px Tahoma;text-align:center;background-color:#333333;color:#ffffff}\n");
                writer.Write(".calendarSecondDefault {cursor:pointer;font:bold 12px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarArrowLeftDefault {font:bold 12px Tahoma;color:#333333;text-align:center;padding-left:4px;padding-right:4px;padding-bottom:6px;padding-top:2px;cursor:pointer; cursor:hand;}\n");
                writer.Write(".calendarArrowRightDefault {font:bold 12px Tahoma;color:#333333;text-align:center;padding-left:4px;padding-right:4px;padding-bottom:6px;padding-top:2px;cursor:pointer; cursor:hand;}\n");
                writer.Write(".calendarMonthDefault {background-color:#F6F6F6;border:1px solid #dddddd;}\n");
                writer.Write(".calendarMonthTitleDefault {font:bold 12px Tahoma;text-align:center;padding:4px;color:#333333;}\n");
                writer.Write(".calendarDayNameDefault {font:bold 11px Tahoma;color:#333333;text-align:center;}\n");
                writer.Write(".calendarDayDefault {font:11px Tahoma;color:#333333;text-align:center;padding:1px;border:1px solid #F6F6F6;cursor:pointer; cursor:hand;}\n");
                writer.Write(".calendarDayOverDefault {font:11px Tahoma;color:#333333;text-align:center;padding:1px;border:1px solid #333333;cursor:pointer; cursor:hand;}\n");
                writer.Write(".calendarDayTodayDefault {font:bold 11px Tahoma;color:navy;text-align:center;padding:1px;background-color:#99ccee;border:1px solid #ECECEE;cursor:pointer; cursor:hand;}\n");
                writer.Write(".calendarDayTodayOverDefault {font:bold 11px Tahoma;color:navy;text-align:center;padding:1px;background-color:#99ccee;border:1px solid #ECECEE;cursor:pointer; cursor:hand;}\n");
                writer.Write(".calendarDayDisabledDefault {font:11px Tahoma;color:#C0C2C1;text-align:center;padding:1px;border:1px solid #F6F6F6;}\n");
                writer.Write(".calendarDayDisabledOverDefault {font:11px Tahoma;color:#C0C2C1;text-align:center;padding:1px;border:1px solid #F6F6F6;}\n");
                writer.Write(".calendarDaySelectedDefault {font:bold 11px Tahoma;color:maroon;text-align:center;border:1px solid crimson;background-color:gold;}\n");
                writer.Write(".calendarDaySelectedOverDefault {font:bold 11px Tahoma;color:maroon;text-align:center;border:1px solid crimson;background-color:gold;}\n");
                writer.Write(".calendarDaySpecialDefault {font:bold 11px Tahoma;color:crimson;text-align:center;padding:1px;border:0px solid #993766;}\n");
                writer.Write(".calendarDaySpecialOverDefault {font:bold 11px Tahoma;color:crimson;text-align:center;padding:1px;border:0px solid #993766;}\n");
                writer.Write(".calendarDatePickerButtonDefault {cursor:pointer; cursor:hand;vertical-align:bottom;}\n");
                writer.Write("</style>");
                this.IsDefaultStyleRendered = true;
            }
            if (this.DatePickerMode)
            {
                if (this.DatePickerImagePath != string.Empty)
                {
                    cSSPath = this.DatePickerImagePath;
                    cSSPath = base.ResolveUrl(cSSPath);
                    writer.Write("<img src=\"" + cSSPath + "\" id=\"_" + this.ClientID + "Button\" alt=\"" + this.DatePickerImageTooltip + "\" title=\"" + this.DatePickerImageTooltip + "\" class=\"" + this.CSSDatePickerButton + "\" onclick=\"" + this.ClientID + ".displayCalendar(event);\" />");
                }
                else
                {
                    writer.Write("<span id=\"_" + this.ClientID + "Button\" class=\"" + this.CSSDatePickerButton + "\" onclick=\"" + this.ClientID + ".displayCalendar(event);\">" + this.DatePickerImageTooltip + "</span>");
                }
            }
            string str6 = "<div style=\"border:2px solid #cccccc; height:45px; font:8pt Verdana; background-color:#eeeeee; text-align:center;\"><a href=\"http://www.vdc.com.vn\">vdc Calendar</a><br />Evaluation has expired.<br /></div>";
            string str7 = "<div style=\"border:2px solid #cccccc; width:150px; height:45px; font:8pt Verdana; background-color:#eeeeee; text-align:center;\"><a href=\"http://www.vdc.com.vn\">vdc Calendar</a><br />Evaluation has expired.<br /></div>";
            bool flag = false;
            if (Constants.SecondExpirationDate && Constants.isTrial)
            {
                writer.Write(str7);
            }
            else
            {
                flag = true;
                writer.Write("<div id=\"_" + this.ClientID + "Container\" style=\"overflow:hidden;position:relative;display:none;\" class=\"" + this.CSSCalendar + "\"" + (this.DatePickerMode ? " onclick=\"event.cancelBubble=true; if(event.stopPropagation) {event.stopPropagation();}\"" : "") + ">");
                writer.Write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">");
                writer.Write("<tr>");
                writer.Write("<td>");
                writer.Write("<div class=\"" + this.CSSArrowLeft + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".prependMonths()');\">" + this.TextArrowLeft + "</div>");
                writer.Write("</td>");
                writer.Write("<td width=\"100%\">");
                writer.Write("<div id=\"TitleId"+this.ClientID+"\" class=\"" + this.CSSTitle + "\">");
                writer.Write(this.TitleText);
                writer.Write(this.GetMonthSelector());
                writer.Write(this.GetYearSelector());
                writer.Write("</div>");
                writer.Write("</td>");
                writer.Write("<td>");
                writer.Write("<div class=\"" + this.CSSArrowRight + "\" onclick=\"" + this.ClientID + ".addToQueue('" + this.ClientID + ".appendMonths()');\">" + this.TextArrowRight + "</div>");
                writer.Write("</td>");
                writer.Write("</tr>");
                writer.Write("</table>");
                HttpBrowserCapabilities browser = HttpContext.Current.Request.Browser;
                if (-1 == browser.Type.IndexOf("IE"))
                {
                    writer.Write("<div style=\"position:relative;overflow:hidden;left:0px;width:800%;\">");
                }
                else
                {
                    writer.Write("<div style=\"position:relative;overflow:hidden;left:0px;width:" + ((this.MonthWidth * this.Columns) + this.MonthMarginWidth) + "px;\">");
                }
                writer.Write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"position:relative;\"><tr></tr></table>");
                writer.Write("</div>");
                writer.Write(this.GetTimeSelector());
            }
            if (!((!Constants.FirstExpirationDate || !Constants.isTrial) || Constants.SecondExpirationDate))
            {
                writer.Write(str6);
            }
            writer.Write("</div>");
            if (flag)
            {
                writer.Write(this.GetYearSelectorContainer());
            }
            if (flag)
            {
                writer.Write(this.GetMonthSelectorContainer());
            }
            if (flag)
            {
                writer.Write(this.GetTimeSelectorContainer());
            }
            if (this.DatePickerMode && flag)
            {
                writer.Write("<IFRAME id=\"_" + this.ClientID + "iframe\" style=\"DISPLAY:none; POSITION:absolute; LEFT:0px; TOP:0px;\" src=\"javascript:false;\" frameBorder=\"0\" scrolling=\"no\"></IFRAME>");
            }
            if (this._inForm)
            {
                if (!Constants.SecondExpirationDate || !Constants.isTrial)
                {
                    if (helper.IsAjax)
                    {
                        helper.RegisterStartupScript(this, this.ClientID, script, true);
                    }
                    else
                    {
                        writer.Write("<script language=\"javascript\">" + script + "</script>");
                    }
                }
            }
            else
            {
                writer.Write("<script type=\"text/javascript\" src=\"" + this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "Vdc.Calendar2.Resources.vdcCalendar2.min.js") + "\"></script>");
                if (!(Constants.SecondExpirationDate && Constants.isTrial))
                {
                    writer.Write("<script type=\"text/javascript\">" + script + "</script>");
                }
            }
        }

        protected override object SaveViewState()
        {
            this.serializeCollection();
            return base.SaveViewState();
        }

        private void serializeCollection()
        {
            XmlDocument document = new XmlDocument();
            XmlNode newChild = document.CreateNode(XmlNodeType.Element, "calendar", "");
            foreach (SpecialDate date in this.SpecialDates)
            {
                XmlElement element = document.CreateElement("specialdate");
                element.SetAttribute("year", date.Year.ToString());
                element.SetAttribute("month", date.Month.ToString());
                element.SetAttribute("day", date.Day.ToString());
                element.SetAttribute("tooltip", date.ToolTip);
                element.SetAttribute("class", date.CSSClass);
                element.SetAttribute("classover", date.CSSClassOver);
                newChild.AppendChild(element);
            }
            document.AppendChild(newChild);
            this.ViewState["CalendarItems"] = document.OuterXml;
        }

        private void YearSelectorMinMaxYear(out int minYear, out int maxYear)
        {
            minYear = (this.DateMin == new DateTime(0L)) ? (this.GetYear(this.DateFirstMonth) - 10) : this.DateMin.Year;
            maxYear = (this.DateMax == new DateTime(0L)) ? (this.GetYear(this.DateFirstMonth) + 10) : this.DateMax.Year;
        }

        private void YearSelectorMinMaxYear(out int minYear, out int maxYear, out int minYearScroll, out int maxYearScroll)
        {
            minYear = (this.DateMin == new DateTime(0L)) ? (this.GetYear(this.DateFirstMonth) - 10) : this.DateMin.Year;
            maxYear = (this.DateMax == new DateTime(0L)) ? (this.GetYear(this.DateFirstMonth) + 10) : this.DateMax.Year;
            DateTime time = new DateTime(0L);
            minYearScroll = (this.YearMinScroll == time.Year) ? (this.GetYear(this.DateFirstMonth) - 3) : this.YearMinScroll;
            minYearScroll = (minYearScroll < minYear) ? minYear : minYearScroll;
            time = new DateTime(0L);
            maxYearScroll = (this.YearMaxScroll == time.Year) ? (this.GetYear(this.DateFirstMonth) + 3) : this.YearMaxScroll;
            maxYearScroll = (maxYearScroll > maxYear) ? maxYear : maxYearScroll;
        }

        [Description("Calendar's align position."), Bindable(true), Category("Date Picker mode"), DefaultValue(0)]
        public Vdc.Calendar2.Align Align
        {
            get
            {
                object obj2 = this.ViewState["Align"];
                if (obj2 == null)
                {
                    this.ViewState["Align"] = Vdc.Calendar2.Align.Cursor;
                    return Vdc.Calendar2.Align.Cursor;
                }
                return (Vdc.Calendar2.Align)obj2;
            }
            set
            {
                this.ViewState["Align"] = value;
            }
        }

        [DefaultValue(true), Category("Settings"), Bindable(true), Description("If true, dates are allowed to be deselected, otherwise not.")]
        public bool AllowDeselect
        {
            get
            {
                return ((this.ViewState["AllowDeselect"] == null) || ((bool) this.ViewState["AllowDeselect"]));
            }
            set
            {
                this.ViewState["AllowDeselect"] = value;
            }
        }

        [Description("If true, regular dates are allowed to be selected."), DefaultValue(true), Bindable(true), Category("Settings")]
        public bool AllowSelectRegular
        {
            get
            {
                return ((this.ViewState["AllowSelectRegular"] == null) || ((bool) this.ViewState["AllowSelectRegular"]));
            }
            set
            {
                this.ViewState["AllowSelectRegular"] = value;
            }
        }

        [Bindable(true), Category("Settings"), DefaultValue(true), Description("If true, special dates are allowed to be selected.")]
        public bool AllowSelectSpecial
        {
            get
            {
                return ((this.ViewState["AllowSelectSpecial"] == null) || ((bool) this.ViewState["AllowSelectSpecial"]));
            }
            set
            {
                this.ViewState["AllowSelectSpecial"] = value;
            }
        }

        [Bindable(true), Category("Settings"), DefaultValue(false), Description("If true, calendar will post back after date is selected.")]
        public bool AutoPostBack
        {
            get
            {
                return ((this.ViewState["AutoPostBack"] != null) && ((bool) this.ViewState["AutoPostBack"]));
            }
            set
            {
                this.ViewState["AutoPostBack"] = value;
            }
        }

        [Description("Calendar ID that is used for beginning date of a date span."), Bindable(true), Category("Date Picker mode"), DefaultValue("")]
        public string BeginDateCalendarId
        {
            get
            {
                string str = (string) this.ViewState["BeginDateCalendarId"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["BeginDateCalendarId"] = value;
            }
        }

        [Category("Appearance"), Description("Number of columns in the calendar."), DefaultValue(2), Bindable(true)]
        public int Columns
        {
            get
            {
                object obj2 = this.ViewState["Columns"];
                return ((obj2 == null) ? 2 : ((int) obj2));
            }
            set
            {
                if (value < 1)
                {
                    this.ViewState["Columns"] = 2;
                }
                else
                {
                    this.ViewState["Columns"] = value;
                }
            }
        }

        [Category("Appearance - CSS"), Description("CSS class for left arrow."), Bindable(true), DefaultValue("")]
        public string CSSArrowLeft
        {
            get
            {
                string str = (string) this.ViewState["CSSArrowLeft"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSArrowLeft"] = value;
            }
        }

        [DefaultValue(""), Category("Appearance - CSS"), Bindable(true), Description("CSS class for right arrow.")]
        public string CSSArrowRight
        {
            get
            {
                string str = (string) this.ViewState["CSSArrowRight"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSArrowRight"] = value;
            }
        }

        [Bindable(true), Description("CSS class for whole calendar."), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSCalendar
        {
            get
            {
                string str = (string) this.ViewState["CSSCalendar"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSCalendar"] = value;
            }
        }

        [Bindable(true), Description("CSS class for DatePicker button."), Category("Date Picker mode"), DefaultValue("")]
        public string CSSDatePickerButton
        {
            get
            {
                string str = (string) this.ViewState["CSSDatePickerButton"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDatePickerButton"] = value;
            }
        }

        [Category("Appearance - CSS"), Description("CSS class for each day."), DefaultValue(""), Bindable(true)]
        public string CSSDay
        {
            get
            {
                string str = (string) this.ViewState["CSSDay"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDay"] = value;
            }
        }

        [Category("Appearance - CSS"), Bindable(true), Description("CSS class for each disabled day."), DefaultValue("")]
        public string CSSDayDisabled
        {
            get
            {
                string str = (string) this.ViewState["CSSDayDisabled"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDayDisabled"] = value;
            }
        }

        [Bindable(true), Description("CSS class for each disabled day when the mouse is over."), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSDayDisabledOver
        {
            get
            {
                string str = (string) this.ViewState["CSSDayDisabledOver"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDayDisabledOver"] = value;
            }
        }

        [DefaultValue(""), Description("CSS class for each day name."), Category("Appearance - CSS"), Bindable(true)]
        public string CSSDayName
        {
            get
            {
                string str = (string) this.ViewState["CSSDayName"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDayName"] = value;
            }
        }

        [Bindable(true), Description("CSS class for each day when the mouse if over."), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSDayOver
        {
            get
            {
                string str = (string) this.ViewState["CSSDayOver"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDayOver"] = value;
            }
        }

        [Bindable(true), Description("CSS class for selected day."), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSDaySelected
        {
            get
            {
                string str = (string) this.ViewState["CSSDaySelected"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDaySelected"] = value;
            }
        }

        [DefaultValue(""), Description("CSS class for selected day when the mouse is over."), Bindable(true), Category("Appearance - CSS")]
        public string CSSDaySelectedOver
        {
            get
            {
                string str = (string) this.ViewState["CSSDaySelectedOver"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDaySelectedOver"] = value;
            }
        }

        [Bindable(true), DefaultValue(""), Description("CSS class for each special day."), Category("Appearance - CSS")]
        public string CSSDaySpecial
        {
            get
            {
                string str = (string) this.ViewState["CSSDaySpecial"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDaySpecial"] = value;
            }
        }

        [Bindable(true), Description("CSS class for each special day when the mouse is over."), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSDaySpecialOver
        {
            get
            {
                string str = (string) this.ViewState["CSSDaySpecialOver"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDaySpecialOver"] = value;
            }
        }

        [DefaultValue(""), Category("Appearance - CSS"), Description("CSS class for today."), Bindable(true)]
        public string CSSDayToday
        {
            get
            {
                string str = (string) this.ViewState["CSSDayToday"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDayToday"] = value;
            }
        }

        [DefaultValue(""), Description("CSS class for today when the mouse is over."), Category("Appearance - CSS"), Bindable(true)]
        public string CSSDayTodayOver
        {
            get
            {
                string str = (string) this.ViewState["CSSDayTodayOver"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSDayTodayOver"] = value;
            }
        }

        [DefaultValue(""), Description("CSS class for selected hour from the hour selector when in html list mode."), Bindable(true), Category("Appearance - CSS")]
        public string CSSHourSelected
        {
            get
            {
                string str = (string) this.ViewState["CSSHourSelected"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSHourSelected"] = value;
            }
        }

        [Description("CSS class for hour from the hour selector when in html list mode."), Bindable(true), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSHourSelector
        {
            get
            {
                string str = (string) this.ViewState["CSSHourSelector"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSHourSelector"] = value;
            }
        }

        [Bindable(true), Description("CCSS class for hour selector's arrow down."), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSHourSelectorArrowDown
        {
            get
            {
                string str = (string) this.ViewState["CSSHourSelectorArrowDown"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSHourSelectorArrowDown"] = value;
            }
        }

        [Category("Appearance - CSS"), Bindable(true), DefaultValue(""), Description("CSS class for hour selector's arrow up.")]
        public string CSSHourSelectorArrowUp
        {
            get
            {
                string str = (string) this.ViewState["CSSHourSelectorArrowUp"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSHourSelectorArrowUp"] = value;
            }
        }

        [Description("CSS class for hour selector container when in html list mode."), Category("Appearance - CSS"), DefaultValue(""), Bindable(true)]
        public string CSSHourSelectorContainer
        {
            get
            {
                string str = (string) this.ViewState["CSSHourSelectorContainer"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSHourSelectorContainer"] = value;
            }
        }

        [DefaultValue(""), Description("CSS class for hour selector title when in html list mode."), Category("Appearance - CSS"), Bindable(true)]
        public string CSSHourSelectorTitle
        {
            get
            {
                string str = (string) this.ViewState["CSSHourSelectorTitle"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSHourSelectorTitle"] = value;
            }
        }

        [Bindable(true), Category("Appearance - CSS"), DefaultValue(""), Description("CSS class for selected minute from the minute selector when in html list mode.")]
        public string CSSMinuteSelected
        {
            get
            {
                string str = (string) this.ViewState["CSSMinuteSelected"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMinuteSelected"] = value;
            }
        }

        [DefaultValue(""), Bindable(true), Category("Appearance - CSS"), Description("CSS class for minute from the minute selector when in html list mode.")]
        public string CSSMinuteSelector
        {
            get
            {
                string str = (string) this.ViewState["CSSMinuteSelector"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMinuteSelector"] = value;
            }
        }

        [Category("Appearance - CSS"), Bindable(true), DefaultValue(""), Description("CCSS class for minute selector's arrow down.")]
        public string CSSMinuteSelectorArrowDown
        {
            get
            {
                string str = (string) this.ViewState["CSSMinuteSelectorArrowDown"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMinuteSelectorArrowDown"] = value;
            }
        }

        [DefaultValue(""), Description("CCSS class for minute selector's arrow up."), Bindable(true), Category("Appearance - CSS")]
        public string CSSMinuteSelectorArrowUp
        {
            get
            {
                string str = (string) this.ViewState["CSSMinuteSelectorArrowUp"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMinuteSelectorArrowUp"] = value;
            }
        }

        [Bindable(true), DefaultValue(""), Description("CSS class for minute selector container when in html list mode."), Category("Appearance - CSS")]
        public string CSSMinuteSelectorContainer
        {
            get
            {
                string str = (string) this.ViewState["CSSMinuteSelectorContainer"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMinuteSelectorContainer"] = value;
            }
        }

        [DefaultValue(""), Description("CSS class for minute selector title when in html list mode."), Bindable(true), Category("Appearance - CSS")]
        public string CSSMinuteSelectorTitle
        {
            get
            {
                string str = (string) this.ViewState["CSSMinuteSelectorTitle"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMinuteSelectorTitle"] = value;
            }
        }

        [DefaultValue(""), Description("CSS class name for each month."), Category("Appearance - CSS"), Bindable(true)]
        public string CSSMonth
        {
            get
            {
                string str = (string) this.ViewState["CSSMonth"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMonth"] = value;
            }
        }

        [Bindable(true), DefaultValue(""), Description("CSS class for selected month from the month selector when in html list mode."), Category("Appearance - CSS")]
        public string CSSMonthSelected
        {
            get
            {
                string str = (string) this.ViewState["CSSMonthSelected"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMonthSelected"] = value;
            }
        }

        [DefaultValue(""), Bindable(true), Description("CSS class for month from the month selector when in html list mode."), Category("Appearance - CSS")]
        public string CSSMonthSelector
        {
            get
            {
                string str = (string) this.ViewState["CSSMonthSelector"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMonthSelector"] = value;
            }
        }

        [Description("CSS class for month selector's arrow down."), Bindable(true), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSMonthSelectorArrowDown
        {
            get
            {
                string str = (string) this.ViewState["CSSMonthSelectorArrowDown"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMonthSelectorArrowDown"] = value;
            }
        }

        [Bindable(true), DefaultValue(""), Description("CCSS class for month selector's arrow up."), Category("Appearance - CSS")]
        public string CSSMonthSelectorArrowUp
        {
            get
            {
                string str = (string) this.ViewState["CSSMonthSelectorArrowUp"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMonthSelectorArrowUp"] = value;
            }
        }

        [DefaultValue(""), Description("CSS class for month selector container when in html list mode."), Category("Appearance - CSS"), Bindable(true)]
        public string CSSMonthSelectorContainer
        {
            get
            {
                string str = (string) this.ViewState["CSSMonthSelectorContainer"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMonthSelectorContainer"] = value;
            }
        }

        [Bindable(true), Description("CSS class for month selector title when in html list mode."), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSMonthSelectorTitle
        {
            get
            {
                string str = (string) this.ViewState["CSSMonthSelectorTitle"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMonthSelectorTitle"] = value;
            }
        }

        [Description("CSS class for each month title."), Bindable(true), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSMonthTitle
        {
            get
            {
                string str = (string) this.ViewState["CSSMonthTitle"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSMonthTitle"] = value;
            }
        }

        [Description("Path to CSS file."), Bindable(true), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSPath
        {
            get
            {
                string str = (string) this.ViewState["CSSPath"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSPath"] = value;
            }
        }

        [Category("Appearance - CSS"), Bindable(true), DefaultValue(""), Description("CSS class for selected second from the second selector when in html list mode.")]
        public string CSSSecondSelected
        {
            get
            {
                string str = (string) this.ViewState["CSSSecondSelected"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSSecondSelected"] = value;
            }
        }

        [Description("CSS class for second from the second selector when in html list mode."), Category("Appearance - CSS"), DefaultValue(""), Bindable(true)]
        public string CSSSecondSelector
        {
            get
            {
                string str = (string) this.ViewState["CSSSecondSelector"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSSecondSelector"] = value;
            }
        }

        [Bindable(true), Category("Appearance - CSS"), DefaultValue(""), Description("CCSS class for second selector's arrow down.")]
        public string CSSSecondSelectorArrowDown
        {
            get
            {
                string str = (string) this.ViewState["CSSSecondSelectorArrowDown"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSSecondSelectorArrowDown"] = value;
            }
        }

        [Bindable(true), Category("Appearance - CSS"), DefaultValue(""), Description("CCSS class for second selector's arrow up.")]
        public string CSSSecondSelectorArrowUp
        {
            get
            {
                string str = (string) this.ViewState["CSSSecondSelectorArrowUp"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSSecondSelectorArrowUp"] = value;
            }
        }

        [Bindable(true), Category("Appearance - CSS"), DefaultValue(""), Description("CSS class for second selector container when in html list mode.")]
        public string CSSSecondSelectorContainer
        {
            get
            {
                string str = (string) this.ViewState["CSSSecondSelectorContainer"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSSecondSelectorContainer"] = value;
            }
        }

        [DefaultValue(""), Category("Appearance - CSS"), Bindable(true), Description("CSS class for second selector title when in html list mode.")]
        public string CSSSecondSelectorTitle
        {
            get
            {
                string str = (string) this.ViewState["CSSSecondSelectorTitle"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSSecondSelectorTitle"] = value;
            }
        }

        [Bindable(true), Category("Appearance - CSS"), Description("CSS class for selecting time button."), DefaultValue("")]
        public string CSSSelectTime
        {
            get
            {
                string str = (string) this.ViewState["CSSSelectTime"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSSelectTime"] = value;
            }
        }

        [Description("CSS class for title."), Bindable(true), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSTitle
        {
            get
            {
                string str = (string) this.ViewState["CSSTitle"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSTitle"] = value;
            }
        }

        [Category("Appearance - CSS"), Description("CSS class for selected year from the year selector when in html list mode."), DefaultValue(""), Bindable(true)]
        public string CSSYearSelected
        {
            get
            {
                string str = (string) this.ViewState["CSSYearSelected"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSYearSelected"] = value;
            }
        }

        [Description("CSS class for year from the year selector when in html list mode."), DefaultValue(""), Bindable(true), Category("Appearance - CSS")]
        public string CSSYearSelector
        {
            get
            {
                string str = (string) this.ViewState["CSSYearSelector"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSYearSelector"] = value;
            }
        }

        [Description("CSS class for year selector's arrow down."), DefaultValue(""), Bindable(true), Category("Appearance - CSS")]
        public string CSSYearSelectorArrowDown
        {
            get
            {
                string str = (string) this.ViewState["CSSYearSelectorArrowDown"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSYearSelectorArrowDown"] = value;
            }
        }

        [Description("CCSS class for year selector's arrow up."), Bindable(true), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSYearSelectorArrowUp
        {
            get
            {
                string str = (string) this.ViewState["CSSYearSelectorArrowUp"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSYearSelectorArrowUp"] = value;
            }
        }

        [Bindable(true), Description("CSS class for year selector container when in html list mode."), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSYearSelectorContainer
        {
            get
            {
                string str = (string) this.ViewState["CSSYearSelectorContainer"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSYearSelectorContainer"] = value;
            }
        }

        [Description("CSS class for year selector title when in html list mode."), Bindable(true), Category("Appearance - CSS"), DefaultValue("")]
        public string CSSYearSelectorTitle
        {
            get
            {
                string str = (string) this.ViewState["CSSYearSelectorTitle"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["CSSYearSelectorTitle"] = value;
            }
        }

        [Description("Set culture which will be used to regionalize the calendar."), Bindable(true), Category("Advanced"), DefaultValue((string) null)]
        private CultureInfo Culture
        {
            get
            {
                object obj2 = this.ViewState["Culture"];
                if (obj2 != null)
                {
                    return (CultureInfo) obj2;
                }
                return new CultureInfo("vi-VN");
            }
            set
            {
                this.ViewState["Culture"] = value;
            }
        }

        [Category("Advanced"), DefaultValue((string) null), Description("Set culture name which will be used to regionalize the calendar."), Bindable(true)]
        public string CultureName
        {
            get
            {
                return this.Culture.Name;
            }
            set
            {
                this.Culture = new CultureInfo(value, false);
            }
        }

        [Bindable(true), Description("Date, month of which to show first."), Category("Settings")]
        public DateTime DateFirstMonth
        {
            get
            {
                object obj2 = this.ViewState["DateFirstMonth"];
                if (obj2 == null)
                {
                    return this.DateToday;
                }
                return (DateTime) obj2;
            }
            set
            {
                this.ViewState["DateFirstMonth"] = value;
            }
        }

        [Category("Advanced"), Bindable(true), Description("Date format.")]
        public string DateFormat
        {
            get
            {
                object obj2 = (string) this.ViewState["DateFormat"];
                if (obj2 != null)
                {
                    return (string) obj2;
                }
                return this.Culture.DateTimeFormat.ShortDatePattern;
            }
            set
            {
                this.ViewState["DateFormat"] = value;
            }
        }

        [Description("The maximum date to display."), Bindable(true), Category("Settings"), DefaultValue("")]
        public DateTime DateMax
        {
            get
            {
                return ((this.ViewState["DateMax"] == null) ? new DateTime(0L) : ((DateTime) this.ViewState["DateMax"]));
            }
            set
            {
                this.ViewState["DateMax"] = value;
            }
        }

        [DefaultValue(""), Description("Minimum date to display."), Bindable(true), Category("Settings")]
        public DateTime DateMin
        {
            get
            {
                return ((this.ViewState["DateMin"] == null) ? new DateTime(0L) : ((DateTime) this.ViewState["DateMin"]));
            }
            set
            {
                this.ViewState["DateMin"] = value;
            }
        }

        [Bindable(true), Description("Path to the image for a date picker button."), Category("Date Picker mode"), DefaultValue("")]
        public string DatePickerImagePath
        {
            get
            {
                string str = (string) this.ViewState["DatePickerImagePath"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["DatePickerImagePath"] = value;
            }
        }

        [Description("Tooltip text for the image for a date picker button."), DefaultValue("Select date"), Category("Date Picker mode"), Bindable(true)]
        public string DatePickerImageTooltip
        {
            get
            {
                string str = (string) this.ViewState["DatePickerImageTooltip"];
                return ((str == null) ? "Select date" : str);
            }
            set
            {
                this.ViewState["DatePickerImageTooltip"] = value;
            }
        }

        [Category("Date Picker mode"), Bindable(true), DefaultValue(false), Description("If true, a text box is displayed for the date and the calendar is hidden.")]
        public bool DatePickerMode
        {
            get
            {
                return ((this.ViewState["DatePickerMode"] != null) && ((bool) this.ViewState["DatePickerMode"]));
            }
            set
            {
                this.ViewState["DatePickerMode"] = value;
            }
        }

        [Category("Date Picker mode"), Bindable(true), Description("If true, calendar is synchronized with the textbox modifications."), DefaultValue(false)]
        public bool DatePickerSynchronize
        {
            get
            {
                return ((this.ViewState["DatePickerSynchronize"] != null) && ((bool) this.ViewState["DatePickerSynchronize"]));
            }
            set
            {
                this.ViewState["DatePickerSynchronize"] = value;
            }
        }

        [DefaultValue(""), Category("Settings"), Description("Today's date."), Bindable(true)]
        public DateTime DateToday
        {
            get
            {
                object obj2 = this.ViewState["DateToday"];
                if (obj2 == null)
                {
                    return DateTime.Today;
                }
                return (DateTime) obj2;
            }
            set
            {
                this.ViewState["DateToday"] = value;
            }
        }

        [Description("If true, the script file resource is disabled."), Bindable(true), Category("Appearance - settings"), DefaultValue(true)]
        public bool DisableEmbeddedScriptFileResource
        {
            get
            {
                return ((this.ViewState["DisableEmbeddedScriptFileResource"] != null) && ((bool) this.ViewState["DisableEmbeddedScriptFileResource"]));
            }
            set
            {
                this.ViewState["DisableEmbeddedScriptFileResource"] = value;
            }
        }

        [Description("If false, calendar is disabled."), Bindable(true), Category("Date Picker mode"), DefaultValue(true)]
        public bool Enabled
        {
            get
            {
                return ((this.ViewState["Enabled"] == null) || ((bool) this.ViewState["Enabled"]));
            }
            set
            {
                this.ViewState["Enabled"] = value;
            }
        }

        [Description("An expression that evaluates to a boolean value that determines whether the date should be enabled or not."), Category("Settings"), DefaultValue("")]
        public string EnabledDateExpression
        {
            get
            {
                string str = (string) this.ViewState["EnabledDateExpression"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["EnabledDateExpression"] = value;
            }
        }

        [Bindable(true), Description("First day of week. Sunday = 0"), Category("Advanced")]
        public int FirstDayOfWeek
        {
            get
            {
                object obj2 = this.ViewState["FirstDayOfWeek"];
                if (obj2 != null)
                {
                    return (int) obj2;
                }
                return (int) this.Culture.DateTimeFormat.FirstDayOfWeek;
            }
            set
            {
                if ((value > -1) && (value < 7))
                {
                    this.ViewState["FirstDayOfWeek"] = value;
                }
            }
        }

        [Bindable(true), Description("First scrolling speed of the hour selector."), Category("Settings"), DefaultValue(0)]
        public int FirstHourSelectorScrollSpeed
        {
            get
            {
                object obj2 = this.ViewState["FirstHourSelectorScrollSpeed"];
                return ((obj2 == null) ? 0 : ((int) obj2));
            }
            set
            {
                this.ViewState["FirstHourSelectorScrollSpeed"] = value;
            }
        }

        [Category("Settings"), Description("First scrolling speed of the minute selector."), DefaultValue(0), Bindable(true)]
        public int FirstMinuteSelectorScrollSpeed
        {
            get
            {
                object obj2 = this.ViewState["FirstMinuteSelectorScrollSpeed"];
                return ((obj2 == null) ? 0 : ((int) obj2));
            }
            set
            {
                this.ViewState["FirstMinuteSelectorScrollSpeed"] = value;
            }
        }

        [DefaultValue(0), Description("First scrolling speed of the second selector."), Bindable(true), Category("Settings")]
        public int FirstSecondSelectorScrollSpeed
        {
            get
            {
                object obj2 = this.ViewState["FirstSecondSelectorScrollSpeed"];
                return ((obj2 == null) ? 0 : ((int) obj2));
            }
            set
            {
                this.ViewState["FirstSecondSelectorScrollSpeed"] = value;
            }
        }

        [Category("Settings"), Description("First scrolling speed of the year selector."), Bindable(true), DefaultValue(0)]
        public int FirstYearSelectorScrollSpeed
        {
            get
            {
                object obj2 = this.ViewState["FirstYearSelectorScrollSpeed"];
                return ((obj2 == null) ? 0 : ((int) obj2));
            }
            set
            {
                this.ViewState["FirstYearSelectorScrollSpeed"] = value;
            }
        }

        [Description("Comma delimetered full day names."), Bindable(true), Category("Advanced")]
        public string FullDayNames
        {
            get
            {
                string str = (string) this.ViewState["FullDayNames"];
                if (str != null)
                {
                    return str;
                }
                for (int i = 0; i < this.Culture.DateTimeFormat.DayNames.Length; i++)
                {
                    str = str + this.Culture.DateTimeFormat.DayNames[i] + ",";
                }
                return str.Remove(str.Length - 1, 1);
            }
            set
            {
                if (value.Split(new char[] { ',' }).Length > 6)
                {
                    this.ViewState["FullDayNames"] = value;
                }
            }
        }

        [Description("Comma delimetered full month names."), Bindable(true), Category("Advanced")]
        public string FullMonthNames
        {
            get
            {
                string str = (string) this.ViewState["FullMonthNames"];
                if (str != null)
                {
                    return str;
                }
                for (int i = 0; i < this.Culture.DateTimeFormat.MonthNames.Length; i++)
                {
                    str = str + this.Culture.DateTimeFormat.MonthNames[i] + ",";
                }
                return str.Remove(str.Length - 1, 1);
            }
            set
            {
                if (value.Split(new char[] { ',' }).Length > 11)
                {
                    this.ViewState["FullMonthNames"] = value;
                }
            }
        }

        [Bindable(true), DefaultValue(100), Description("Scrolling speed of the hour selector."), Category("Settings")]
        public int HourSelectorScrollSpeed
        {
            get
            {
                object obj2 = this.ViewState["HourSelectorScrollSpeed"];
                return ((obj2 == null) ? 100 : ((int) obj2));
            }
            set
            {
                this.ViewState["HourSelectorScrollSpeed"] = value;
            }
        }

        private bool IsDefaultStyleRendered
        {
            get
            {
                if (this.Page.Session["ob_cal_IsDefaultStyleRendered"] == null)
                {
                    this.Page.Session["ob_cal_IsDefaultStyleRendered"] = false;
                }
                return (bool) this.Page.Session["ob_cal_IsDefaultStyleRendered"];
            }
            set
            {
                this.Page.Session["ob_cal_IsDefaultStyleRendered"] = value;
            }
        }

        [Category("Settings"), Description("Scrolling speed of the minute selector."), Bindable(true), DefaultValue(100)]
        public int MinuteSelectorScrollSpeed
        {
            get
            {
                object obj2 = this.ViewState["MinuteSelectorScrollSpeed"];
                return ((obj2 == null) ? 100 : ((int) obj2));
            }
            set
            {
                this.ViewState["MinuteSelectorScrollSpeed"] = value;
            }
        }

        [Description("Height of each month box in Html page"), Bindable(true), Category("Appearance"), DefaultValue(160)]
        public int MonthHeight
        {
            get
            {
                object obj2 = this.ViewState["MonthHeight"];
                return ((obj2 == null) ? 160 : ((int) obj2));
            }
            set
            {
                this.ViewState["MonthHeight"] = value;
            }
        }

        [Category("Appearance"), Description("Width of a margin around each month."), Bindable(true), DefaultValue(5)]
        public int MonthMarginWidth
        {
            get
            {
                object obj2 = this.ViewState["MonthMarginWidth"];
                return ((obj2 == null) ? 5 : ((int) obj2));
            }
            set
            {
                this.ViewState["MonthMarginWidth"] = value;
            }
        }

        [DefaultValue(1), Description("Calendar's year selector type."), Bindable(true), Category("Appearance - settings")]
        public SelectorType MonthSelectorType
        {
            get
            {
                object obj2 = this.ViewState["MonthSelectorType"];
                if (obj2 == null)
                {
                    this.ViewState["MonthSelectorType"] = SelectorType.HtmlList;
                    return SelectorType.HtmlList;
                }
                return (SelectorType) obj2;
            }
            set
            {
                this.ViewState["MonthSelectorType"] = value;
            }
        }

        [Category("Appearance"), Description("Width of each month box in Html page"), Bindable(true), DefaultValue(0xaf)]
        public int MonthWidth
        {
            get
            {
                object obj2 = this.ViewState["MonthWidth"];
                return ((obj2 == null) ? 0xaf : ((int) obj2));
            }
            set
            {
                this.ViewState["MonthWidth"] = value;
            }
        }

        [Bindable(true), DefaultValue(false), Category("Settings"), Description("If true, calendar will be able to have multiple selected dates.")]
        public bool MultiSelectedDates
        {
            get
            {
                return ((this.ViewState["MultiSelectedDates"] != null) && ((bool) this.ViewState["MultiSelectedDates"]));
            }
            set
            {
                this.ViewState["MultiSelectedDates"] = value;
            }
        }

        [Bindable(true), Description("Left offset from left edge of datepicker icon (can be negative)."), Category("Date Picker mode"), DefaultValue(0)]
        public int OffsetLeft
        {
            get
            {
                object obj2 = this.ViewState["OffsetLeft"];
                return ((obj2 == null) ? 0 : ((int) obj2));
            }
            set
            {
                this.ViewState["OffsetLeft"] = value;
            }
        }

        [Category("Date Picker mode"), Bindable(true), DefaultValue(0), Description("Top offset from top edge of datepicker icon (can be negative).")]
        public int OffsetTop
        {
            get
            {
                object obj2 = this.ViewState["OffsetTop"];
                return ((obj2 == null) ? 0 : ((int) obj2));
            }
            set
            {
                this.ViewState["OffsetTop"] = value;
            }
        }

        [Description("Function to execute on client side when selected date changes."), DefaultValue(""), Category("Settings")]
        public string OnClientDateChanged
        {
            get
            {
                string str = (string) this.ViewState["OnClientDateChanged"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["OnClientDateChanged"] = value;
            }
        }

        [Description("Function to execute on client side on date mouseout event."), DefaultValue(""), Category("Settings")]
        public string OnClientDateMouseOut
        {
            get
            {
                string str = (string) this.ViewState["OnClientDateMouseOut"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["OnClientDateMouseOut"] = value;
            }
        }

        [Description("Function to execute on client side on date mouseover event."), DefaultValue(""), Category("Settings")]
        public string OnClientDateMouseOver
        {
            get
            {
                string str = (string) this.ViewState["OnClientDateMouseOver"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["OnClientDateMouseOver"] = value;
            }
        }

        [Description("Function to execute client side on calendar scrolling to left."), DefaultValue(""), Category("Settings")]
        public string OnClientMonthScrollLeft
        {
            get
            {
                string str = (string) this.ViewState["OnClientMonthScrollLeft"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["OnClientMonthScrollLeft"] = value;
            }
        }

        [Description("Function to execute client side on calendar scrolling to right."), Category("Settings"), DefaultValue("")]
        public string OnClientMonthScrollRight
        {
            get
            {
                string str = (string) this.ViewState["OnClientMonthScrollRight"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["OnClientMonthScrollRight"] = value;
            }
        }

        [DefaultValue(""), Description("Function to execute client side on calendar switching view."), Category("Settings")]
        public string OnSwitchView
        {
            get
            {
                string str = (string) this.ViewState["OnSwitchView"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["OnSwitchView"] = value;
            }
        }

        [Bindable(true), Description("Number of rows in the calendar."), Category("Appearance"), DefaultValue(1)]
        public int Rows
        {
            get
            {
                object obj2 = this.ViewState["Rows"];
                return ((obj2 == null) ? 1 : ((int) obj2));
            }
            set
            {
                if (value < 1)
                {
                    this.ViewState["Rows"] = 1;
                }
                else
                {
                    this.ViewState["Rows"] = value;
                }
            }
        }

        [DefaultValue(1), Bindable(true), Description("Number of columns to scroll by."), Category("Appearance")]
        public int ScrollBy
        {
            get
            {
                object obj2 = this.ViewState["ScrollBy"];
                return ((obj2 == null) ? 1 : ((int) obj2));
            }
            set
            {
                if (value > 0)
                {
                    this.ViewState["ScrollBy"] = value;
                }
            }
        }

        [Bindable(true), DefaultValue(100), Description("Scrolling speed of the second selector."), Category("Settings")]
        public int SecondSelectorScrollSpeed
        {
            get
            {
                object obj2 = this.ViewState["SecondSelectorScrollSpeed"];
                return ((obj2 == null) ? 100 : ((int) obj2));
            }
            set
            {
                this.ViewState["SecondSelectorScrollSpeed"] = value;
            }
        }

        [Category("Settings"), Description("Get or set the selected date."), Bindable(true)]
        public DateTime SelectedDate
        {
            get
            {
                if (this.ViewState["SelectedDate"] != null)
                {
                    return (DateTime) this.ViewState["SelectedDate"];
                }
                return new DateTime(0L);
            }
            set
            {
                if (DateTime.Equals(value, new DateTime(0L)))
                {
                    this.ViewState["SelectedDate"] = null;
                }
                else
                {
                    this.ViewState["SelectedDate"] = value;
                }
            }
        }

        [Description("Get or set the selected dates."), Category("Settings"), Bindable(true)]
        public SelectedDatesList SelectedDates
        {
            get
            {
                if (this.ViewState["SelectedDates"] == null)
                {
                    this.ViewState["SelectedDates"] = new SelectedDatesList();
                }
                return (SelectedDatesList) this.ViewState["SelectedDates"];
            }
            set
            {
                this.ViewState["SelectedDates"] = value;
            }
        }

        [Description("Comma delimetered abbreviated day names."), Bindable(true), Category("Advanced")]
        public string ShortDayNames
        {
            get
            {
                string str = (string) this.ViewState["ShortDayNames"];
                if (str != null)
                {
                    return str;
                }
                if (this.ViewState["Culture"] == null)
                {
                    return "Su,Mo,Tu,We,Th,Fr,Sa";
                }
                for (int i = 0; i < this.Culture.DateTimeFormat.AbbreviatedDayNames.Length; i++)
                {
                    str = str + this.Culture.DateTimeFormat.AbbreviatedDayNames[i] + ",";
                }
                return str.Remove(str.Length - 1, 1);
            }
            set
            {
                if (value.Split(new char[] { ',' }).Length > 6)
                {
                    this.ViewState["ShortDayNames"] = value;
                }
            }
        }

        [Bindable(true), Category("Advanced"), Description("Comma delimetered abbreviated month names.")]
        public string ShortMonthNames
        {
            get
            {
                string str = (string) this.ViewState["ShortMonthNames"];
                if (str != null)
                {
                    return str;
                }
                for (int i = 0; i < this.Culture.DateTimeFormat.AbbreviatedMonthNames.Length; i++)
                {
                    str = str + this.Culture.DateTimeFormat.AbbreviatedMonthNames[i] + ",";
                }
                return str.Remove(str.Length - 1, 1);
            }
            set
            {
                if (value.Split(new char[] { ',' }).Length > 11)
                {
                    this.ViewState["ShortMonthNames"] = value;
                }
            }
        }

        [DefaultValue(true), Description("If true, the alert message in case of some error is visible."), Category("Appearance - settings"), Bindable(true)]
        public bool ShowErrorAlert
        {
            get
            {
                return ((this.ViewState["ShowErrorAlert"] == null) || ((bool) this.ViewState["ShowErrorAlert"]));
            }
            set
            {
                this.ViewState["ShowErrorAlert"] = value;
            }
        }

        [Bindable(true), Description("If true, hour selector is shown."), Category("Appearance - settings"), DefaultValue(true)]
        public bool ShowHourSelector
        {
            get
            {
                return ((this.ViewState["ShowHourSelector"] == null) || ((bool) this.ViewState["ShowHourSelector"]));
            }
            set
            {
                this.ViewState["ShowHourSelector"] = value;
            }
        }

        [Bindable(true), Description("If true, minute selector is shown."), DefaultValue(true), Category("Appearance - settings")]
        public bool ShowMinuteSelector
        {
            get
            {
                return ((this.ViewState["ShowMinuteSelector"] == null) || ((bool) this.ViewState["ShowMinuteSelector"]));
            }
            set
            {
                this.ViewState["ShowMinuteSelector"] = value;
            }
        }

        [DefaultValue(true), Description("If true, month selector is shown."), Bindable(true), Category("Appearance - settings")]
        public bool ShowMonthSelector
        {
            get
            {
                return ((this.ViewState["ShowMonthSelector"] != null) && ((bool) this.ViewState["ShowMonthSelector"]));
            }
            set
            {
                this.ViewState["ShowMonthSelector"] = value;
            }
        }

        [Category("Appearance - settings"), Bindable(true), DefaultValue(true), Description("If true, previous and next month days are also shown in every calendar.")]
        public bool ShowOtherMonthDays
        {
            get
            {
                return ((this.ViewState["ShowOtherMonthDays"] == null) || ((bool) this.ViewState["ShowOtherMonthDays"]));
            }
            set
            {
                this.ViewState["ShowOtherMonthDays"] = value;
            }
        }

        [Bindable(true), Category("Appearance - settings"), DefaultValue(true), Description("If true, second selector is shown.")]
        public bool ShowSecondSelector
        {
            get
            {
                return ((this.ViewState["ShowSecondSelector"] == null) || ((bool) this.ViewState["ShowSecondSelector"]));
            }
            set
            {
                this.ViewState["ShowSecondSelector"] = value;
            }
        }

        [Bindable(true), DefaultValue(true), Description("If true, time selector is shown."), Category("Appearance - settings")]
        public bool ShowTimeSelector
        {
            get
            {
                return ((this.ViewState["ShowTimeSelector"] != null) && ((bool) this.ViewState["ShowTimeSelector"]));
            }
            set
            {
                this.ViewState["ShowTimeSelector"] = value;
            }
        }

        [Description("If true, year selector is shown."), Bindable(true), Category("Appearance - settings"), DefaultValue(true)]
        public bool ShowYearSelector
        {
            get
            {
                return ((this.ViewState["ShowYearSelector"] != null) && ((bool) this.ViewState["ShowYearSelector"]));
            }
            set
            {
                this.ViewState["ShowYearSelector"] = value;
            }
        }

        [Category("Settings"), PersistenceMode(PersistenceMode.InnerDefaultProperty), Description("A collection containing all special dates"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), NotifyParentProperty(true)]
        public CalendarSpecialDates SpecialDates
        {
            get
            {
                if (this._items == null)
                {
                    this._items = new CalendarSpecialDates();
                }
                return this._items;
            }
        }

        [Bindable(true), Description("Scrolling speed."), Category("Settings"), DefaultValue(0x19)]
        public int Speed
        {
            get
            {
                object obj2 = this.ViewState["Speed"];
                return ((obj2 == null) ? 0x19 : ((int) obj2));
            }
            set
            {
                this.ViewState["Speed"] = value;
            }
        }

        [Description("Path to folder with style for calendar."), Bindable(true), Category("Appearance - CSS"), DefaultValue("")]
        public string StyleFolder
        {
            get
            {
                string str = (string) this.ViewState["StyleFolder"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["StyleFolder"] = value;
                if (this.ViewState["CSSCalendar"] == null)
                {
                    this.CSSCalendar = "calendarCalendar";
                }
                if (this.ViewState["CSSTitle"] == null)
                {
                    this.CSSTitle = "calendarTitle";
                }
                if (this.ViewState["CSSYearSelectorTitle"] == null)
                {
                    this.CSSYearSelectorTitle = "calendarYearSelectorTitle";
                }
                if (this.ViewState["CSSYearSelectorContainer"] == null)
                {
                    this.CSSYearSelectorContainer = "calendarYearSelectorContainer";
                }
                if (this.ViewState["CSSYearSelectorArrowUp"] == null)
                {
                    this.CSSYearSelectorArrowUp = "calendarYearSelectorArrowUp";
                }
                if (this.ViewState["CSSYearSelectorArrowDown"] == null)
                {
                    this.CSSYearSelectorArrowDown = "calendarYearSelectorArrowDown";
                }
                if (this.ViewState["CSSYearSelector"] == null)
                {
                    this.CSSYearSelector = "calendarYearSelector";
                }
                if (this.ViewState["CSSYearSelected"] == null)
                {
                    this.CSSYearSelected = "calendarYearSelected";
                }
                if (this.ViewState["CSSMonthSelectorTitle"] == null)
                {
                    this.CSSMonthSelectorTitle = "calendarMonthSelectorTitle";
                }
                if (this.ViewState["CSSMonthSelectorContainer"] == null)
                {
                    this.CSSMonthSelectorContainer = "calendarMonthSelectorContainer";
                }
                if (this.ViewState["CSSMonthSelectorArrowUp"] == null)
                {
                    this.CSSMonthSelectorArrowUp = "calendarMonthSelectorArrowUp";
                }
                if (this.ViewState["CSSMonthSelectorArrowDown"] == null)
                {
                    this.CSSMonthSelectorArrowDown = "calendarMonthSelectorArrowDown";
                }
                if (this.ViewState["CSSMonthSelector"] == null)
                {
                    this.CSSMonthSelector = "calendarMonthSelector";
                }
                if (this.ViewState["CSSMonthSelected"] == null)
                {
                    this.CSSMonthSelected = "calendarMonthSelected";
                }
                if (this.ViewState["CSSSelectTime"] == null)
                {
                    this.CSSSelectTime = "calendarSelectTime";
                }
                if (this.ViewState["CSSHourSelectorTitle"] == null)
                {
                    this.CSSHourSelectorTitle = "calendarHourSelectorTitle";
                }
                if (this.ViewState["CSSHourSelectorContainer"] == null)
                {
                    this.CSSHourSelectorContainer = "calendarHourSelectorContainer";
                }
                if (this.ViewState["CSSHourSelectorArrowUp"] == null)
                {
                    this.CSSHourSelectorArrowUp = "calendarHourSelectorArrowUp";
                }
                if (this.ViewState["CSSHourSelectorArrowDown"] == null)
                {
                    this.CSSHourSelectorArrowDown = "calendarHourSelectorArrowDown";
                }
                if (this.ViewState["CSSHourSelector"] == null)
                {
                    this.CSSHourSelector = "calendarHourSelector";
                }
                if (this.ViewState["CSSHourSelected"] == null)
                {
                    this.CSSHourSelected = "calendarHourSelected";
                }
                if (this.ViewState["CSSMinuteSelectorTitle"] == null)
                {
                    this.CSSMinuteSelectorTitle = "calendarMinuteSelectorTitle";
                }
                if (this.ViewState["CSSMinuteSelectorContainer"] == null)
                {
                    this.CSSMinuteSelectorContainer = "calendarMinuteSelectorContainer";
                }
                if (this.ViewState["CSSMinuteSelectorArrowUp"] == null)
                {
                    this.CSSMinuteSelectorArrowUp = "calendarMinuteSelectorArrowUp";
                }
                if (this.ViewState["CSSMinuteSelectorArrowDown"] == null)
                {
                    this.CSSMinuteSelectorArrowDown = "calendarMinuteSelectorArrowDown";
                }
                if (this.ViewState["CSSMinuteSelector"] == null)
                {
                    this.CSSMinuteSelector = "calendarMinuteSelector";
                }
                if (this.ViewState["CSSMinuteSelected"] == null)
                {
                    this.CSSMinuteSelected = "calendarMinuteSelected";
                }
                if (this.ViewState["CSSSecondSelectorTitle"] == null)
                {
                    this.CSSSecondSelectorTitle = "calendarSecondSelectorTitle";
                }
                if (this.ViewState["CSSSecondSelectorContainer"] == null)
                {
                    this.CSSSecondSelectorContainer = "calendarSecondSelectorContainer";
                }
                if (this.ViewState["CSSSecondSelectorArrowUp"] == null)
                {
                    this.CSSSecondSelectorArrowUp = "calendarSecondSelectorArrowUp";
                }
                if (this.ViewState["CSSSecondSelectorArrowDown"] == null)
                {
                    this.CSSSecondSelectorArrowDown = "calendarSecondSelectorArrowDown";
                }
                if (this.ViewState["CSSSecondSelector"] == null)
                {
                    this.CSSSecondSelector = "calendarSecondSelector";
                }
                if (this.ViewState["CSSSecondSelected"] == null)
                {
                    this.CSSSecondSelected = "calendarSecondSelected";
                }
                if (this.ViewState["CSSArrowLeft"] == null)
                {
                    this.CSSArrowLeft = "calendarArrowLeft";
                }
                if (this.ViewState["CSSArrowRight"] == null)
                {
                    this.CSSArrowRight = "calendarArrowRight";
                }
                if (this.ViewState["CSSMonth"] == null)
                {
                    this.CSSMonth = "calendarMonth";
                }
                if (this.ViewState["CSSMonthTitle"] == null)
                {
                    this.CSSMonthTitle = "calendarMonthTitle";
                }
                if (this.ViewState["CSSDayName"] == null)
                {
                    this.CSSDayName = "calendarDayName";
                }
                if (this.ViewState["CSSDay"] == null)
                {
                    this.CSSDay = "calendarDay";
                }
                if (this.ViewState["CSSDayOver"] == null)
                {
                    this.CSSDayOver = "calendarDayOver";
                }
                if (this.ViewState["CSSDayToday"] == null)
                {
                    this.CSSDayToday = "calendarDayToday";
                }
                if (this.ViewState["CSSDayTodayOver"] == null)
                {
                    this.CSSDayTodayOver = "calendarDayTodayOver";
                }
                if (this.ViewState["CSSDayDisabled"] == null)
                {
                    this.CSSDayDisabled = "calendarDayDisabled";
                }
                if (this.ViewState["CSSDayDisabledOver"] == null)
                {
                    this.CSSDayDisabledOver = "calendarDayDisabledOver";
                }
                if (this.ViewState["CSSDaySelected"] == null)
                {
                    this.CSSDaySelected = "calendarDaySelected";
                }
                if (this.ViewState["CSSDaySelectedOver"] == null)
                {
                    this.CSSDaySelectedOver = "calendarDaySelectedOver";
                }
                if (this.ViewState["CSSDaySpecial"] == null)
                {
                    this.CSSDaySpecial = "calendarDaySpecial";
                }
                if (this.ViewState["CSSDaySpecialOver"] == null)
                {
                    this.CSSDaySpecialOver = "calendarDaySpecialOver";
                }
                if (this.ViewState["CSSDatePickerButton"] == null)
                {
                    this.CSSDatePickerButton = "calendarDatePickerButton";
                }
            }
        }

        [Bindable(true), Description("Scroll left text."), Category("Appearance - settings"), DefaultValue("&lt;&lt;")]
        public string TextArrowLeft
        {
            get
            {
                string str = (string) this.ViewState["TextArrowLeft"];
                return ((str == null) ? "&lt;&lt;" : str);
            }
            set
            {
                this.ViewState["TextArrowLeft"] = value;
            }
        }

        [Description("Scroll right text."), Bindable(true), Category("Appearance - settings"), DefaultValue("&gt;&gt;")]
        public string TextArrowRight
        {
            get
            {
                string str = (string) this.ViewState["TextArrowRight"];
                return ((str == null) ? "&gt;&gt;" : str);
            }
            set
            {
                this.ViewState["TextArrowRight"] = value;
            }
        }

        [DefaultValue(""), Description("TextBoxId to display the date in."), Bindable(true), Category("Date Picker mode")]
        public string TextBoxId
        {
            get
            {
                string str = (string) this.ViewState["TextBoxId"];
                return ((str == null) ? string.Empty : str);
            }
            set
            {
                this.ViewState["TextBoxId"] = value;
            }
        }

        [Category("Appearance - settings"), Bindable(true), Description("Select time text."), DefaultValue("Set")]
        public string TextSelectTime
        {
            get
            {
                string str = (string) this.ViewState["TextSelectTime"];
                return ((str == null) ? "Set" : str);
            }
            set
            {
                this.ViewState["TextSelectTime"] = value;
            }
        }

        [Category("Appearance - settings"), Bindable(true), Description("Calendar's time selector type."), DefaultValue(1)]
        public SelectorType TimeSelectorType
        {
            get
            {
                object obj2 = this.ViewState["TimeSelectorType"];
                if (obj2 == null)
                {
                    this.ViewState["TimeSelectorType"] = SelectorType.HtmlList;
                    return SelectorType.HtmlList;
                }
                return (SelectorType) obj2;
            }
            set
            {
                this.ViewState["TimeSelectorType"] = value;
            }
        }

        [DefaultValue(""), Category("Appearance - settings"), Description("Text to display in the title."), Bindable(true)]
        public string TitleText
        {
            get
            {
                string str = (string) this.ViewState["TitleText"];
                return ((str == null) ? DateTime.Today.ToString("D", this.Culture) : str);
            }
            set
            {
                this.ViewState["TitleText"] = value;
            }
        }

        [Bindable(true), DefaultValue(""), Category("Settings"), Description("The maximum year to display without scrolling.")]
        public int YearMaxScroll
        {
            get
            {
                return ((this.ViewState["YearMaxScroll"] == null) ? new DateTime(0L).Year : ((int) this.ViewState["YearMaxScroll"]));
            }
            set
            {
                this.ViewState["YearMaxScroll"] = value;
            }
        }

        [Bindable(true), Description("Minimum year to display without scrolling."), Category("Settings"), DefaultValue("")]
        public int YearMinScroll
        {
            get
            {
                return ((this.ViewState["YearMinScroll"] == null) ? new DateTime(0L).Year : ((int) this.ViewState["YearMinScroll"]));
            }
            set
            {
                this.ViewState["YearMinScroll"] = value;
            }
        }

        [Category("Advanced"), Description("Month and year format for every month title."), Bindable(true)]
        public string YearMonthFormat
        {
            get
            {
                object obj2 = (string) this.ViewState["YearMonthFormat"];
                if (obj2 != null)
                {
                    return (string) obj2;
                }
                return this.Culture.DateTimeFormat.YearMonthPattern;
            }
            set
            {
                this.ViewState["YearMonthFormat"] = value;
            }
        }

        [Category("Settings"), Bindable(true), DefaultValue(100), Description("Scrolling speed of the year selector.")]
        public int YearSelectorScrollSpeed
        {
            get
            {
                object obj2 = this.ViewState["YearSelectorScrollSpeed"];
                return ((obj2 == null) ? 100 : ((int) obj2));
            }
            set
            {
                this.ViewState["YearSelectorScrollSpeed"] = value;
            }
        }

        [Description("Calendar's year selector type."), Bindable(true), Category("Appearance - settings"), DefaultValue(1)]
        public SelectorType YearSelectorType
        {
            get
            {
                object obj2 = this.ViewState["YearSelectorType"];
                if (obj2 == null)
                {
                    this.ViewState["YearSelectorType"] = SelectorType.HtmlList;
                    return SelectorType.HtmlList;
                }
                return (SelectorType) obj2;
            }
            set
            {
                this.ViewState["YearSelectorType"] = value;
            }
        }

        [CLSCompliant(true)]
        public class CalendarSpecialDates : CollectionBase
        {
            public void Add(SpecialDate newDate)
            {
                base.List.Add(newDate);
            }

            public void Insert(int index, SpecialDate value)
            {
                ((IList) this).Insert(index, value);
            }

            public void Remove(SpecialDate existingDate)
            {
                for (int i = 0; i < base.List.Count; i++)
                {
                    if (((SpecialDate) base.List[i]).Equals(existingDate))
                    {
                        base.List.RemoveAt(i);
                        break;
                    }
                }
            }

            public void Remove(int index)
            {
                base.List.RemoveAt(index);
            }

            public SpecialDate this[int index]
            {
                get
                {
                    return (SpecialDate) base.List[index];
                }
            }
        }

        [Serializable, CLSCompliant(true)]
        public class SelectedDatesList : CollectionBase
        {
            public void Add(DateTime date)
            {
                bool flag = false;
                for (int i = 0; i < base.List.Count; i++)
                {
                    DateTime time = (DateTime) base.List[i];
                    if (time.Year == date.Year)
                    {
                        time = (DateTime) base.List[i];
                    }
                    if ((time.Month == date.Month) && ((time = (DateTime) base.List[i]).Day == date.Day))
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    base.List.Add(date);
                }
            }

            public DateTime this[int index]
            {
                get
                {
                    return (DateTime) base.List[index];
                }
            }
        }
    }
}

